The antibiotic trimethoprim (TMP) is used to treat a variety of Escherichia coli infections, but its efficacy is limited by the rapid emergence of TMP-resistant bacteria. Previous laboratory evolution experiments have identified resistance-conferring mutations in the gene encoding the TMP target, bacterial dihydrofolate reductase (DHFR), in particular mutation L28R. Here, we show that 4’-desmethyltrimethoprim (4’-DTMP) inhibits both DHFR and its L28R variant, and selects against the emergence of TMP-resistant bacteria that carry the L28R mutation in laboratory experiments. Furthermore, antibiotic-sensitive E. coli populations acquire antibiotic resistance at a substantially slower rate when grown in the presence of 4’-DTMP than in the presence of TMP. We find that 4’-DTMP impedes evolution of resistance by selecting against resistant genotypes with the L28R mutation and diverting genetic trajectories to other resistance-conferring DHFR mutations with catalytic deficiencies. Our results demonstrate how a detailed characterization of resistance-conferring mutations in a target enzyme can help identify potential drugs against antibiotic-resistant bacteria, which may ultimately increase long-term efficacy of antimicrobial therapies by modulating evolutionary trajectories that lead to resistance.