Clostridioides difficile infection (CDI) causes severe diarrhea and colitis, leading to significant morbidity, mortality, and high medical costs worldwide. Oral vancomycin, a first-line treatment for CDI, is associated with a high risk of recurrence, necessitating novel therapies for primary and recurrent CDI. A novel small-molecule compound, CDBN-YGXZ, was synthesized by modifying the benzene ring of nitazoxanide with lauric acid. The mechanism of action of CDBN-YGXZ was validated using a pyruvate:ferredoxin/flavodoxin oxidoreductase (PFOR) inhibition assay. The efficacy of CDBN-YGXZ was evaluated using the MIC test and CDI infection model in mice and hamsters. Furthermore, metagenomics was used to reveal the underlying reasons for the effective reduction or prevention of CDI after CDBN-YGXZ treatment. The inhibitory activity against PFOR induced by CDBN-YGXZ. MIC tests showed that the in vitro activity of CDBN-YGXZ against C. difficile ranging from 0.1 to 1.5 μg/mL. In the mouse and hamster CDI models, CDBN-YGXZ provided protection during both treatment and relapse, while vancomycin treatment resulted in severe relapse and significant clinical scores. Compared with global effects on the indigenous gut microbiota induced by vancomycin, CDBN-YGXZ treatment had a mild influence on gut microbes, thus resulting in the disappearance or reduction of CDI recurrence. CDBN-YGXZ displayed potent activity against C. difficile in vitro and in vivo, reducing or preventing relapse in infected animals, which could merit further development as a potential drug candidate for treating CDI.