The gut microbiota plays a critical role in host health and disease resistance. This study investigated the relationship between gut microbiota and disease resistance in piglets using single-cell transcriptomics, 16S amplicon sequencing, metagenomics, and untargeted metabolomics. Porcine epidemic diarrhea virus (PEDV) infection significantly altered the gut microbiota of piglets. Landrace pigs showed rapid loss of resistance to PEDV, but fecal microbiota transplantation from Min pigs improved their resistance. Macrogenomic and animal protection models identified Lactobacillus reuteri and Lactobacillus amylovorus as playing an anti-infective role in the gut microbiota. Metabolomic analysis showed that lithocholic acid (LCA) correlated with these bacteria and exerted protective effects in the animal model. LCA supplementation altered the distribution of intestinal T-cell populations, increased CD8⁺ CTLs, and enhanced SLA-I expression in porcine intestinal epithelial cells via FXR receptors, recruiting CD8⁺ CTLs to exert antiviral effects. The study concludes that gut microbiota diversity influences disease development, and manipulating Lactobacillus reuteri, Lactobacillus amylovorus, and LCA represents a promising strategy to improve PEDV infection in piglets. The findings highlight the importance of gut microbiota in disease resistance and the potential of LCA as a therapeutic agent.The gut microbiota plays a critical role in host health and disease resistance. This study investigated the relationship between gut microbiota and disease resistance in piglets using single-cell transcriptomics, 16S amplicon sequencing, metagenomics, and untargeted metabolomics. Porcine epidemic diarrhea virus (PEDV) infection significantly altered the gut microbiota of piglets. Landrace pigs showed rapid loss of resistance to PEDV, but fecal microbiota transplantation from Min pigs improved their resistance. Macrogenomic and animal protection models identified Lactobacillus reuteri and Lactobacillus amylovorus as playing an anti-infective role in the gut microbiota. Metabolomic analysis showed that lithocholic acid (LCA) correlated with these bacteria and exerted protective effects in the animal model. LCA supplementation altered the distribution of intestinal T-cell populations, increased CD8⁺ CTLs, and enhanced SLA-I expression in porcine intestinal epithelial cells via FXR receptors, recruiting CD8⁺ CTLs to exert antiviral effects. The study concludes that gut microbiota diversity influences disease development, and manipulating Lactobacillus reuteri, Lactobacillus amylovorus, and LCA represents a promising strategy to improve PEDV infection in piglets. The findings highlight the importance of gut microbiota in disease resistance and the potential of LCA as a therapeutic agent.