To study whether children with peptic ulcer would have abnormalities in cellular and humoral immune functions, and whether Helicobacter pylori (Hp) infection would affect the immune function of children with peptic ulcer. This is a retrospective study. The subjects of study were 72 children with diagnosed and cured peptic ulcer (ulcer group), and 50 healthy children with physical examination (control group) at Baoding Hospital, Beijing Children's Hospital Affiliated to Capital Medical University from June 2020 to December 2022. Further detection was conducted on T lymphocyte subsets (CD3+, CD4+, CD8+, and CD4+/CD8+ ratio) and immunoglobulin levels. Of the 72 children with peptic ulcer, 53(73.6%) were positive for Hp (Hp-positive group) and 19 (26.4%) were negative (Hp-negative group). The levels of CD3+, CD4+, and CD4+/CD8+ ratio in the control group were significantly higher than those in the ulcer group, with statistically significant difference (P<0.05); while the level of IgG in the control group was lower than that in the ulcer group, with statistically significant difference (P<0.05). Meanwhile, there were statistically significant differences in that the levels of CD3+, CD4+ and CD8+ were increased in Hp-positive group than those in Hp-negative group before treatment (P<0.05); while CD4+/CD8+ ratio was lower in the former group than that in the latter group, with statistically significant difference (P<0.05). Hp infection can induce the elevation of T lymphocyte subsets. The development of peptic ulcer has an intimate association with the disorder of cellular and humoral immune functions.