Ulcerative colitis (UC) is a chronic immune-related disease which changes in intestinal microbiota and damage to the intestinal barrier contribute to its pathogenesis. Human mas-related G protein-coupled receptor X2 (MRGPRX2) and its mice homolog Mrgprb2 are selectively expressed on mast cells (MCs) to recruit immune cells and modulate host defense against microbial infection. To investigate the role of Mrgprb2 in UC, we compared the differences between Mrgprb2 knockout (b2 KO) mice and wild-type (WT) mice with dextran sulfate sodium (DSS)-induced colitis in the severity of clinical symptoms, inflammatory cells infiltration, degree of intestinal barrier damage, and composition of intestinal flora. The results showed that the weight loss, disease activity index (DAI) score, colon shortening, colonic pathological damage were significantly increased in b2 KO mice while MCs activation, cytokines and chemokines secretion, and inflammatory cell infiltration were decreased. In addition, the abundance and diversity of intestinal microbiota were reduced in b2 KO mice. B2 KO mice also exhibited the reduction of probiotics such as norank_F_Muribaculaceae and Lactobacillus and increase of harmful bacteria like Escherichia-Shigella. Intestinal mucosal barrier damage of b2 KO mice was more severe than WT mice due to the attenuated expression of mucin2(MUC2), occludin, junctional adhesion molecules (JAM)-A. These results demonstrated that Mrgprb2 may have protective effect on DSS-induced colitis by regulating intestinal flora disorder, participating in barrier repair, and recruiting inflammatory cells to eliminate pathogens.