The multi-mode composite imaging technology integrates the advantages of different sensors, and thus has the advantages of high image quality, strong information acquisition capability, high target detection and recognition ability, strong adaptability to complex environments, and high stability and robustness of the system. Among them, the terahertz and infrared composite imaging technology combines the characteristics of terahertz band and infrared band, has the advantages of wide spectrum coverage, high resolution and strong penetration, and has broad application prospects. As one of the key components of the common aperture composite imaging system, the efficient optical splitters in terahertz and infrared band are still lacking at present, and their performance needs to be improved urgently. In this paper, a kind of dichroic metasurface with a simple structure and high performance is proposed by combining simulation experiment and theoretical explanation. When used as a spectroscopic device at an incident angle of 45°, it achieves a transmission coefficient greater than 97% near the center frequency of 1.1 THz, and a reflection coefficient greater than 98% in a wavelength range of 3–5 μm for medium-wave infrared and 8–14 μm for long-wave infrared. The design has good robustness to structural mismatches and machining errors such as structural misalignment, structural fillet, small magnification scaling, and polarization insensitivity. When the incident angle changes in a range of 0–60°, the device still maintains excellent spectral characteristics. In this paper, based on Babinet theorem and equivalent circuit model, the electromagnetic response characteristics of the metasurface are analyzed theoretically, and the analysis results are in agreement with the simulation results. The results of this study prove the feasibility of metasurface as a spectral device in the multiwavelength composite imaging system of terahertz and infrared bands, and provide support for future studying new composite imaging detection technology. In addition, the metasurface structure described in this paper has broad application prospects in many fields such as multi-band infrared stealth, laser and pump light separation in lasers, and provides a valuable reference for designing terahertz and infrared spectroscopy in various scenarios. In the following figure, for S wave and P wave at an incident angle of 45°, panel (a) shows the reflection coefficients varying with the wavelength of metasurface and panel (b) displays terahertz transmission coefficient changing with frequency.