Inflammatory bowel disease (IBD) is a chronic inflammatory disorder characterized by dysregulated immune responses in the gastrointestinal tract. One intriguing aspect of IBD is the potential involvement of ferroptosis, but the mechanism remains incompletely understood. In this study, 27 ferroptosis-related genes (FRGs) were identified differentially expressed between IBD and non-IBD control samples. We used CIBERSORT to compare alterations in the mucosal immune microenvironment between the above two group samples, and found that M1 macrophages and neutrophil infiltration increased in IBD. Two clusters based on consensus clustering of 27 FRGs led to significant changes in the abundance of CD4 memory resting T cells, M2 macrophages, and resting mast cells. Subsequently, 23 hub genes were identified, which could distinguish IBD samples into two distinct clusters with noticeable differences in immune therapy response. Furthermore, scRNA sequencing data based on these 23 hub genes uncovered the highest ferroptosis scores in CD8+ T effector memory (Tem) cells, and their expression underwent significant changes along the differentiation trajectory of CD8+ Tem cells. The random forest model identified eight decisive genes, out of which ferroptosis-related hub genes (SEMA3E, SLC46A1, AC092652.1, DACT2, IL17C, and KRTAP5.2) were confirmed by RT-qPCR in the IBD mouse model. This study reveals ferroptosis-mediated immune microenvironment in IBD and provides multiple potential targets for IBD treatment.