β-Casomorphin-7 (BCM), a breakdown product of milk β-casein, exhibits opioid activity. Opioids are known to affect the immune system, but the effects of BCM on ulcerative colitis (UC) are not clear. We examined the effects of BCM on mucosal immunity using a mouse dextran sulfate sodium-induced colitis model and an in vitro CD8+ T cell activation model. Human UC patients were examined to reveal the relationship between CD10 and mucosal immunity. Combined treatment of the colitis model with thiorphan (TOP) inhibited BCM degradation by suppressing CD10 in the intestinal mucosa, activating mouse mucosal CD8, and suppressing CD4 and Treg. In the CD8+ T cell in vitro activation assay using mouse splenocytes, BCM inhibited the oxidative phosphorylation (OXPHOS) of CD8+ T cells and induced the glycolytic pathway, promoting their activation. Conversely, in a culture system, BCM suppressed OXPHOS and decreased defensin α production in IEC6 mouse intestinal epithelial cells. In the mouse model, BCM reduced defensin α and butyrate levels in the colonic mucosa. During the active phase of human ulcerative colitis, the downward regulation of ileal CD10 expression by CpG methylation of the gene promoter was observed, resulting in increased CD8 activation and decreased defensin α and butyrate levels. BCM is a potential aggravating factor for UC and should be considered in the design of dietary therapy. In addition, decreased CD10 expression may serve as an indicator of UC activity and recurrence, but further clinical studies are needed.