The present invention relates to a 2-triazolyl thiochromone compound (formula I), which has the following structure, wherein R1 is a five-membered triazolyl ring substituted by hydrogen or C1-C3 alkyl, R2 is hydroxyl, C1-C6 hydrocarbyloxy, C1-C6 hydrocarbylamino, C1-C6 hydrocarbonyl, phenyl, phenyl substituted by one or a plurality of C1-C6 hydrocarbyloxy, phenoxy and phenoxy substituted by one or a plurality of C1-C6 hydrocarbyloxy, R3, R4 and R6 are respectively and independently selected from hydrogen, fluorine, chlorine, bromine and iodine, and R5 is selected from hydrogen, fluorine, chlorine, bromine, iodine, C1-C6 hydrocarbyloxy, C1-C6 hydrocarbylamino, phenoxy, and phenoxy substituted by one or a plurality of C1-C6 hydrocarbonyl or hydrocarbyloxy. According to the present invention, the compound can be used for preparing antifungal drugs, provides strong antibacterial activity on common pathogenic fungi and deep fungal infections, and has advantages of low toxicity, good stability, and wide anti-fungal spectrum. The formula I is defined in the specification.