With the rapid advancements in aerospace technology and infrared detection technology, there are increasing needs for materials with simultaneous infrared camouflage and radiative cooling capabilities. In this study, a three-layered Ge/Ag/Si thin film structure on a titanium alloy TC4 substrate (a widely used skin material for spacecraft) is designed and optimized to achieve such spectral compatibility by combining the transfer matrix method and the genetic algorithm. The structure exhibits a low average emissivity of 0.11 in the atmospheric windows of 3–5 μm and 8–14 μm for infrared camouflage and a high average emissivity of 0.69 in 5–8 μm for radiative cooling. Furthermore, the designed metasurface shows a high degree of robustness regarding the polarization and incidence angle of the incoming electromagnetic wave. The underlying mechanisms allowing for the spectral compatibility of the metasurface can be elucidated as follows: the top Ge layer selectively transmits electromagnetic waves ranging from 5–8 μm while it reflects those in the ranges of 3–5 μm and 8–14 μm. The transmitted electromagnetic waves from the Ge layer are first absorbed by the Ag layer and then localized in the Fabry-Perot resonance cavity formed by Ag layer, Si layer and TC4 substrate. Ag and TC4 make further intrinsic absorptions during the multiple reflections of the localized electromagnetic waves.