Background: This study aims to screen target genes with high relevance by running the random walk with restart (RWR) algorithm on the target background network, and to explore the mechanism of Astragalus membranaceus (AM) mediating targets in the treatment of post-infectious irritable bowel syndrome (PI-IBS) by experimental validation. Methods: AM active ingredients were retrieved from TCMSP and HERB databases, of which target genes were predicted by SwissTargetPrediction. The disease genes were obtained by retrieving irritable bowel syndrome (IBS) from disease databases, and integrated to AM target genes to obtain "AM-IBS" intersection genes. The RWR algorithm was used to identify "AM-IBS" crossover genes, and target genes were screened based on correlation scores. The rat model of PI-IBS was established by multiple compound stimulation, followed by treatment with different doses of AM (0.2, 1, 2 g/(kg·d)). Intestinal function of rats was assessed by measuring fecal water content and body weight. Sucrose preference test and open-field test were performed to assess changes in behaviors of rats during the experiment. The expression of Toll-like receptor 4 (TLR4) in colon tissues was detected by immunohistochemistry, and the co-localized expression pattern of polymerase I and transcript release factor (PTRF) /TLR4 was observed by immunofluorescence. Results: At the end of the modeling, the body weight of PI-IBS rats was decreased, but fecal water content, levels of tumor necrosis factor-alpha (TNF-α) and interleukin-6 (IL-6), as well as depressionand anxiety-like behaviors were increased, all of which were improved to varying degrees after AM treatment. Moreover complex stimulation of rats with EPSD, TNBS and CUMS induced higher levels of anxiety and depression, while AM treatment reduced anxiety and depression levels. Notably, AM treatment could inhibit the overexpression of TLR4. Conclusion: Astragalus membranaceus has a certain therapeutic effect on PI-IBS and may improve PI-IBS symptoms by regulating the PTRF/TLR4-related pathway.