Dental caries is a costly and prevalent disease characterized by the demineralization of the tooth's enamel. Disease outcome is influenced by host factors, dietary intake, cariogenic bacteria, and other microbes. The cariogenic bacterial species Streptococcus mutans metabolizes sucrose to initiate biofilm formation on the tooth surface and consequently produces lactic acid to degrade the tooth's enamel. Persistence of S. mutans biofilms in the oral cavity can lead to tooth decay. To date, no anticaries therapies that specifically target S. mutans biofilms but do not disturb the overall oral microbiome are available. We screened a library of 2-Aminoimidazole antibiofilm compounds with a biofilm dispersion assay and identified a small molecule that specifically targets S. mutans biofilms. At 5 μM, the small molecule annotated 3F1 dispersed 50% of the established S. mutans biofilm but did not disperse biofilms formed by the commensal species Streptococcus sanguinis or Streptococcus gordonii. 3F1 dispersed S. mutans biofilms independently of biofilm-related factors such as antigen I/II and glucosyltransferases. 3F1 treatment effectively prevented dental caries by controlling S. mutans in a rat caries model without perturbing the oral microbiota. Our study demonstrates that selective targeting of S. mutans biofilms by 3F1 was able to effectively reduce dental caries in vivo without affecting the overall oral microbiota shaped by the intake of dietary sugars, suggesting that the pathogenic biofilm-specific treatment is a viable strategy for disease prevention.