Electromagnetic interference (EMI) shielding optical windows are crucial for the optimal performance of electro-optical systems in environments exposed to electromagnetic radiation. Traditionally, metallic mesh structures have been favored as the optimal solution, offering high spectral transmittance coupled with efficient electromagnetic shielding. However, these conventional periodic meshes often lead to diffraction effects that can degrade image quality. In contrast, random structures partially homogenize high-order diffraction but lack thorough optimization. To address these challenges, we employ a novel optimization process to develop an innovative multiband optical window based on layered functional structures. This design employs a randomized metallic mesh structure, dramatically reducing higher-order diffraction optical energy by 74% compared to its periodic counterparts. Additionally, the device's EMI shielding effectiveness exceeds 20 dB in the 12-18 GHz frequency band. Moreover, a multiband antireflection coating comprising a 9-layer ZnS/YbF3 stack has been applied to minimize residual reflections achieving an average optical transmittance of 86.1% in the 0.4-0.7µm band, 89.8% at 1.064µm, and 81.1% in the 3-5µm band. We anticipate that our proposed multiband optical window will greatly enhance the application and effectiveness of EMI shielding in optical windows.