Early weaning usually causes intestinal disorders, enteritis, and diarrhea in young animals and human infants. Astragalus polysaccharides (APS) possesses anti‐inflammatory activity. To study the anti‐inflammatory mechanisms of APS and its potential effects on intestinal health, we performed an RNA sequencing (RNA‐seq) study in lipopolysaccharide (LPS)‐stimulated porcine intestinal epithelial cells (IPEC‐J2) in vitro. In addition, LPS‐stimulated BALB/c mice were used to study the effects of APS on intestinal inflammation in vivo. The results from the RNA‐seq analysis show that there were 107, 756, and 5 differentially expressed genes in the control versus LPS, LPS versus LPS+APS, and control versus LPS+APS comparison groups, respectively. The results of Kyoto Encyclopedia of Genes and Genomes enrichment analysis indicated that the mitogen‐activated protein kinase (MAPK) and nuclear factor‐κB (NF‐κB) signaling pathways play significant roles in the regulation of inflammatory factors and chemokine expression by APS. Further verification of the above two pathways by using western blot and immunofluorescence analysis revealed that the gene expression levels of the phosphorylated p38 MAPK, ERK1/2, and NF‐κB p65 were inhibited by APS, while the expression of IκB‐α protein was significantly increased (p < .05), indicating that APS inhibits the production of inflammatory factors and chemokines by the inhibition of activation of the MAPK and NF‐κB inflammatory pathways induced by LPS stimulation. Animal experiments further demonstrated that prefeeding APS in BALB/c mice can alleviate the expression of the jejunal inflammatory factors interleukin 6 (IL‐6), IL‐Iβ, and tumor necrosis factor‐α induced by LPS stimulation and improve jejunal villus morphology.