Streptococcus mutans is a major aetiological agent of dental caries. Formation of biofilms is a key virulence factor of S. mutans. Drugs that inhibit S. mutans biofilms may have therapeutic potential. Dihydrofolate reductase (DHFR) plays a critical role in regulating the metabolism of folate. DHFR inhibitors are thus potent drugs and have been explored as anticancer and antimicrobial agents. In this study, a library of analogues based on a DHFR inhibitor, trimetrexate (TMQ), an FDA-approved drug, was screened and three new analogues that selectively inhibited S. mutans were identified. The most potent inhibitor had a 50% inhibitory concentration (IC50) of 454.0 ± 10.2 nM for the biofilm and 8.7 ± 1.9 nM for DHFR of S. mutans. In contrast, the IC50 of this compound for human DHFR was ca. 1000 nM, a >100-fold decrease in its potency, demonstrating the high selectivity of the analogue. An analogue that exhibited the least potency for the S. mutans biofilm also had the lowest activity towards inhibiting S. mutans DHFR, further indicating that inhibition of biofilms is related to reduced DHFR activity. These data, along with docking of the most potent analogue to the modelled DHFR structure, suggested that the TMQ analogues indeed selectively inhibited S. mutans through targeting DHFR. These potent and selective small molecules are thus promising lead compounds to develop new effective therapeutics to prevent and treat dental caries.