Based on lattice vibration and energy band theory, narrow bandgap inorganic semiconductor materials have become a new type of photothermal material, but it is difficult to achieve absorption for long wavelength infrared radiation to meet the application requirements of ultra-wide spectrum (2.5–20 μm) infrared detectors. From the perspective of structural optics, this paper constructed a multilevel porous CuO film with both coral-like micro-porous and flower-like nano-porous structures based on chemical bath deposition technique, and the Ag nanoparticles were uniformly embedded in the "petal" gaps of flower-like nano-porous CuO by optimizing the dosages of PVP. Benefiting from the synergistic effect of multilevel porous structure and loaded Ag nanoparticles, the Ag nanoparticles modified multilevel porous CuO (CuO@Ag-PVP 0.05) film had an average absorption of 94.17 % over the wavelength range of 2.5–20 μm. The photothermal conversion efficiency of CuO@Ag-PVP 0.05 film can reach up to 81.12 % and 86.96 % over near-infrared and far-infrared light ranges, respectively. The various material characterizations and simulations analysis showed that the multilevel porous structure containing coral-like and flower-like multi-scale pores can form two guiding modes for light, and based on the synergistic effect of the two guiding modes, the CuO film can form a strong trapping effect for light over ultra-wide spectral range, broaden its absorption range, and enhance its absorption characteristics. The loaded Ag nanoparticles contain a large number of free electrons, which can capture light energy and convert it into heat energy through local surface plasmon resonance (LSPR) effect, further enhancing the light absorption and photothermal conversion efficiency.