We design an optical fiber spectrometer based on optical fiber Mach-Zehnder interferometer. In optical fiber Fourier transform spectrometer spectra information is obtained by Fourier transform of interferogram, which recording intensity change vs. optical path difference. Optical path difference is generated by stretching one fiber arm which wound around fiber stretch drive by high power supply. Information from detector is linear with time rather than with optical path difference. In order to obtain high accuracy wavenumber, reference beam is used to control the optical path difference. Optical path difference is measured by reference laser interference fringe. Interferogram vs. optical path difference is resampled by Brault algorithm with information from reference beam and test beam. In the same condition, one-sided interferogram has higher resolution than that of two-sided interferogram. For one-sided interferogram, zero path difference position must be determined as accurately as possible, small shift will result in phase error. For practical experiment in laboratory, position shift is inevitable, so phase error correction must be considered. Zero order fringe is determined by curve fitting. Spectrum of light source is obtained from one-sided interferogram by Fourier cosine transform. A spectral resolution of about ~3.1 cm-1 is achieved. In practice, higher resolution is needed. This compact equipment will be used in emission spectra and absorption spectra, especially in infrared region.