Context: Changes in the gut microbiome are linked with Type 2diabetes mellitus (T2DM) development, but alterations in patients with diabetic retinopathy (DR) are still being debated. Objective: To investigate the differences in biodiversity and relative abundance of gut microbiome between patients with DR and T2DM. Methods: A comprehensive search was performed in five electronic databases (PubMed, EMBASE, Cochrane Central Register of Controlled Trials, Web of Science, and CNKI) from the inception of each database through to August 2023. The standardized mean difference (SMD) and its 95% confidence interval (CI) were estimated using Stata 15.1. Furthermore, the alpha diversity index and relative abundance of the gut microbiome were calculated. The Egger test determined publication bias in the literature. Results: Seven case-control studies were included in the final dataset, comprising 195 patients with DR and 211 patients with T2DM. Compared to T2DM patients, patients in the DR group had a reduced but not significantly different alpha-diversity. The analysis of microbial composition at the phylum level revealed a marked increase in the relative abundance of Bacteroidetes(ES = 23.27, 95%CI[8.30, 38.23], P = 0.000) and a decline in Firmicutes(ES = 47.05, 95%CI[36.58, 57.52], P = 0.000), Proteobacteria (ES = 11.08, 95%CI[6.08, 16.07], P = 0.000) and Actinobacteria (ES = 10.43, 95%CI[1.64, 19.22], P = 0.001) in patients with DR when compared to those with T2DM. Conclusions: An association exists between alterations in the gut microbiome of T2DM and the development and progression of DR. This suggests that re-establishing homeostasis of the gut microbiome could be a potential way to prevent or treat DR and requires further confirmation in future studies. Registration database: Prospero. Registration number: CRD42023455280.