Growing evidence indicates that the dysbiosis of the gut microbiota is closely associated with pathogenesis and progression of diabetes, one of the most pressing global public health concerns. Ejiao is a traditional Chinese medicine and food derived from donkey hide and, is rich in a variety of bioactive ingredients including collagen protein, carbohydrates and other essential nutrients. Here we explored the effects of Ejiao as prebiotic to enhance glucose homeostasis and mitigate inflammation in db/db mice. We observed that Ejiao administration exhibited significant reductions in fasting blood glucose and lipid levels, decreased pancreatic damage, and improved islet morphology. Furthermore, Ejiao administration alleviated immune dysfunction in diabetes, such as restoring the proportion of macrophages in lymph nodes and peripheral blood, and reducing the levels of circulating CD8+T cells. The fecal genomic sequencing showed that Ejiao administration reduced the abundance of the potential pathogen Bacillus, enriched the abundance of Lactobacillus associated with the production of indole derivatives in db/db mice. Above results shown the potential of Ejiao as a prebiotic agent to alleviate diabetes-related symptoms, offering a promising avenue for type 2 diabetes management.