Fungal contamination poses a serious threat to public health and food safety because molds can grow under stressful conditions through melanin accumulation. Although ultraviolet (UV) irradiation is popular for inhibiting microorganisms, its effectiveness is limited by our insufficient knowledge about UV tolerance in melanin-accumulating molds. In this study, we first confirmed the protective effect of melanin by evaluating the UV sensitivity of young and mature spores. Additionally, we compared UV sensitivity between spores with accumulated melanin and spores prepared with melanin biosynthesis inhibitors. We found that mature spores were less UV-sensitive than young spores, and that reduced melanin accumulation by inhibitors led to reduced UV sensitivity. These results suggest that melanin protects cells against UV irradiation. To determine the most effective wavelength for inhibition, we evaluated the wavelength dependence of UV tolerance in a yeast (Rhodotorula mucilaginosa) and in molds (Aspergillus fumigatus, Cladosporium halotolerans, Cladosporium sphaerospermum, Aspergillus brasiliensis, Penicillium roqueforti, and Botrytis cinerea). We assessed UV tolerance using a UV-light emitting diode (LED) irradiation system with 13 wavelength-ranked LEDs between 250 and 365nm, a krypton chlorine (KrCl) excimer lamp device, and a low pressure (LP) Hg lamp device. The inhibition of fungi peaked at around 270nm, and most molds showed reduced UV sensitivity at shorter wavelengths as they accumulated pigment. Absorption spectra of the pigments showed greater absorption at shorter wavelengths, suggesting greater UV protection at these wavelengths. These results will assist in the development of fungal disinfection systems using UV, such as closed systems of air and water purification.