A series of new 2-azolyl-3,4-dihydroquinazolines 6 was synthesized by direct cyclization of imidazole or 1,2,4-triazole with carbodiimides 4, which were obtained from aza-Wittig reaction of iminophosphorane 3 with isocyanate. The preliminary bioassay results demonstrated that most of the 2-imidazolyl-3,4-dihydroquinazolines 6a-6i exhibited good to significant fungicidal activity against Penicillium digitatum , whereas 2-triazolyl-3,4-dihydroquinazolines 6j-6t exhibited low fungicidal activity. Some of the 2-imidazolyl-3,4-dihydroquinazolines 6a-6i also exhibited strong binding interaction with the cytochrome P450-dependent sterol 14α-demethylase (CYP51). For example, compound 6e showed the best fungicidal activity against P. digitatum with IC(50) = 4.14 μg/mL and the best CYP51 binding activity with K(d) = 0.34 μg/mL, both superior to those of the agricultural fungicide triadimefon.