Depression is a common mental disease, with some patients exhibiting ideas and behaviors such as self-harm and suicide. The drugs currently used to treat depression have not achieved good results. It has been reported that metabolites produced by intestinal microbiota affect the development of depression. In this study, core targets and core compounds were screened by specific algorithms in the database, and three-dimensional structures of these compounds and proteins were simulated by molecular docking and molecular dynamics software to further study the influence of intestinal microbiota metabolites on the pathogenesis of depression. By analyzing the RMSD gyration radius and RMSF, it was finally determined that NR1H4 had the best binding effect with genistein. Finally, according to Lipinski's five rules, equol, genistein, quercetin and glycocholic acid were identified as effective drugs for the treatment of depression. In conclusion, the intestinal microbiota can affect the development of depression through the metabolites equol, genistein and quercetin, which act on the critical targets of DPP4, CYP3A4, EP300, MGAM and NR1H4.