The invention discloses a novel thiazole compound capable of inhibiting streptococcus mutans. The compound number is XQH-3-6, the molecular formula is C16H16ClN5O4S, the molecular weight is 409.85, and the Chinese name is N1-(3-chlorphenyl-N4-(5-nitrothiazole-2-yl))piperidine-1,4-dicarboxamide. Experiments show that the compound presents the good antibacterial activity and fungicidal activity on type strains and clinical strains of the streptococcus mutans in a floating state. Meanwhile, when the final concentration of the compound XQH-3-6 in a culture medium reaches 4 mg / L, the inhibition ratio of streptococcus mutans biological membrane reaches 97% or above. The compound is small in molecular weight and simple in structure, inhibition experiments prove that the compound has the advantages of being high in inhibition, good in killing effect and the like, growth of main pathogen-streptococcus mutans buoyant cells of caries and formation of a biological membrane can be significantly inhibited, the potential of preventing the caries is achieved, and the compound can serve as a novel targeted candidate drug for preventing the caries.