Design and performance of a terahertz Fourier transform spectrometer for axion dark matter experiments