Acousto-Optic Tunable Filter (AOTF) based spectroscopy instruments have been widely applied in biomedical, agricultural, aerospace and other fields. However, the conventional AOTF spectrometers struggle to achieve increased system luminous flux while maintaining spectral resolution and reducing the number of samples. To address the above problems, this paper proposes an AOTF spectral measurement method based on compressed sensing (CS) theory. Sparse randomly coded composite optical signal modulation in the spectral dimension using the multifrequency acousto-optic diffraction of AOTF. A modulated composite optical signal is obtained in the spectral dimension and recorded sequentially using cell or plane array detectors. The original spectrum or spectral image data cube is then obtained by compressed sensing reconstruction algorithms. In order to verify the effectiveness of this method, we simulated the effect of compressive sampling and target data recovery by using the actual measurement to obtain the real value of AOTF spectral transmittance data. The simulation results show that the method can reconstruct the spectral data of 512 wavelength-points by 202 times compressive sampling, and the luminous flux can be improved by a factor of 5, and it has a high similarity with the data obtained by wavelength-by-wavelength acquisition. Compared with the conventional wavelength-by-wavelength point-scan sampling method, this technique can provide higher throughput and fewer measures while maintaining spectral resolution. Besides, the spectral data compression with a compression ratio of 0.39 was also achieved during the sampling process. It is of high significance in applications such as detection of weak signals, rapid identification of substances, and compression of spectral data.