The invention discloses a pyrazolyl-oxa(thia)diazole compound containing pyridinium salt, and a preparation method and application thereof. The compound has the structure as shown in the following general formula (I). On the basis of a pyrazolyl-oxa(thia)diazole thioether(oxoether) compound, a pyridinium group capable of improving the biological activity of a target compound is introduced into the system to synthesize a series of pyrazolyl-oxa(thia)diazole oxoether or thioether amphipathic molecules containing the pyridinium salt; moreover, the compound has a good inhibition effect on pathogenic bacteria and fungi, has good inhibition effects on bacteria (bacterial leaf blight of rice, ralstonia solanacearum, xanthomonas citri and the like) and fungi (gibberella zeae, phytophthora infestans, rhizoctonia solani, botrytis cinerea pers, fusarium oxysporum, apple rot pathogenic bacteria and the like), and provides an important scientific base for research, development and creation of novel pesticides.