In the present study, an inulin-type fructan (ITF) with the degree polymerization (DP) of 21 was isolated from Codonopsis pilosula roots and its structure was characterized by FT-IR, MALDI-TOF-MS and NMR. The immunomodulatory and intestinal protective effects of ITF were investigated on immunosuppressive mice. Male BALB/c mice were pretreated with cyclophosphamide (Cy) for 3 days to establish an immunosuppressive model followed by ITF treatment. The results demonstrated that compared with the model group, ITF administration significantly increased immune organ index (P<0.05), alleviated intestinal villus damage, stimulated serum cytokine secretion including Ig G, IL-4, IL-6, IL-2, TNF-α, and INF-γ (P<0.05), upregulated the expression of Occludin and Claudin-1 (P<0.05), and increased CD4+ and CD8+ T cells of ileum in Cy-induced mice (P<0.05). Furthermore, ITF restored the intestinal microbiota dysbiosis caused by Cy by increasing the abundance of Muribaculaceae, Blautia, Odoribacter, Lactobacillus and decreasing the abundance of Lachnospiraceae_NK4A136_group (P<0.05). Meanwhile, ITF increased the production of short-chain fatty acids (SCFAs) including acetic acid, propionic acid and butyric acid (P<0.05). These results indicated that ITF can ameliorate cyclophosphamide-induced immunosuppression and intestinal barrier injury, and restore gut microbiota dysbiosis. This study provided important evidences for the immunomodulatory and intestinal protective effects of the ITF from C. pilosula.