Background Type 2 diabetes (T2D) aggravates the injury of ischemic stroke (IS). The gut microbiota-related metabolite phenylacetylglutamine (PAGln) has been shown to elevate in plasma of patients with T2D and promote thrombosis. However, the alterations of gut microbiota and PAGln levels in stroke patients with T2D remain unclear. Therefore, our study aimed to explore the differences in gut microbiota and its metabolite PAGln between IS patients with and without T2D.Methods In our study, 35 IS with T2D (IS-T2D group), 50 IS patients without T2D (IS group), and 29 healthy controls (HC group) were recruited from December 2019 to December 2020. Fecal samples were collected and analyzed using 16S rRNA high throughput sequencing, and plasma samples were subjected to targeted metabolomics to detect metabolite PAGln. Plasma PAGln levels of rats with transplantation of fecal microbes from patients were assessed. Results Our results showed that compared with the IS group, the relative abundances of Proteobacteria, Verrucomicrobiota, Enterobacteriaceae, and Klebsiella were enriched in the IS-T2D group. The plasma PAGln levels in IS-T2D patients were significantly higher than those in IS patients. Correlation analysis showed that plasma PAGln levels were significantly correlated with Enterobacteriaceae, Verrucomicrobiota, and Klebsiella, which were enriched in IS-T2D patients. Further studies demonstrated that plasma PAGln levels were positively correlated with the concentration of NETs, and NETs levels were increased in a dose-dependent manner according to PAGln levels. In addition, the rats transplanted with fecal microbes from IS-T2D patients developed more severe brain injury and higher plasma PAGln levels compared to the rats transplanted with fecal microbes from IS patients. Moreover, a prediction model based on the differential relative abundances of microbiota, plasma PAGln levels, and NETs levels was constructed to discriminate IS-T2D from stroke patients. Conclusions Our results suggest that the gut microbiota is imbalanced and its metabolite PAGln levels are increased in stroke patients with T2D, and T2D potentially aggravates stroke injury via an inflammatory response, which is associated with gut microbiota and its metabolite PAGln modulation.