Nontuberculous mycobacteria (NTM) are emerging human pathogens linked to severe pulmonary diseases. Current treatments involve the prolonged use of multiple drugs and are often ineffective. Bacterial dihydrofolate reductase (DHFR) is a key enzyme targeted by antibiotics in Gram-negative bacterial infections. However, existing DHFR inhibitors designed for Gram-negative bacteria often fail against mycobacterial DHFRs. Here, we detail the rational design of NTM DHFR inhibitors based on P218, a malarial DHFR inhibitor. We identified compound 8, a 2,4-diaminopyrimidine exhibiting improved pharmacological properties and activity against purified DHFR, and whole cell cultures of two predominant NTM species: Mycobacterium avium and Mycobacterium abscessus. This study underscores the potential of compound 8 as a promising candidate for the in vivo validation of DHFR as an effective treatment against NTM infections.