The well-acknowledged sulfur-containing amino acid ergothioneine (EGT), which is usually perceived to be produced from fungi, cyanobacteria, and mushrooms, has been increasingly demonstrated as a diet-derived antioxidant with therapeutic potential. However, little is known regarding the therapeutic benefit against ulcerative colitis of EGT. Meanwhile, few studies have reported whether EGT could be produced by Pleurotus ostreatus, which is the second most cultivated edible mushroom worldwide, with ideal economic and ecological values and medicinal properties. In the current study, EGT was primarily extracted and isolated from P. ostreatus by water extraction and alcohol precipitation. Then, the Sephadex G-10 gel permeation chromatography and preparative high-performance liquid chromatography were employed in order to purify and collect EGT. Based on nuclear magnetic resonance spectrum characterization, the content of EGT extracted from P. ostreatus is 1.916 mg/g (the weight of EGT is the same as that of dry P. ostreatus). Finally, both the antioxidant activity in vitro and potential effects of EGT on dextran sulfate sodium-induced ulcerative colitis in rats were investigated. The results showed that the collected EGT exhibited strong antioxidant activity with a concentration-dependent manner in 1,1-diphenyl-2-picrylhydrazyl and 2,2'-azinobis (3-ethylbenzoline-6-sulphonic acid) assays. The oral administration of EGT can significantly alleviate colon length shortening and colonic pathological damage, mediated by downregulating the expression of pro-inflammatory factors and inhibiting TLR4/MyD88/NF-κB signaling pathway. Therefore, this study demonstrated that EGT from P. ostreatus would be an excellent dietary compound to ameliorate ulcerative colitis. PRACTICAL APPLICATION: In order to develop Pleurotus ostreatus as a functional food and related products for the prevention and treatment of ulcerative colitis, the separation and purification technology of ergothioneine (EGT) from P. ostreatus was studied, which not only provided a new and broader source for the acquisition and development of EGT, but also provided a basis for the development of EGT as a drug against UC.