Abstract Metasurfaces showcase the performance of light field manipulation at the subwavelength scale, which brings forth the tremendous applications in the field of optical imaging and sensing, especially in the spectroscopic detection. Here, we demonstrate a spectral detector composed of metal-insulator-metal (MIM) composite structures working in midinfrared band, which can effectively collect and restore target spectral characteristics in the midinfrared band with trained reconstruction algorithm. The proposed device consists of snapshot multichannel detection and spectral reconstruction, showing the average spectral reconstruction accuracy approaching 80% of the system. Moreover, we discuss the feasibility of applying this structural design into a miniature spectrometer over a wider infrared wavelength range by proposing a feasible design strategy. Our result provides a new approach for low-cost and portable midinfrared spectroscopic detection in ultracompact midinfrared spectral imaging and sensing elements.