Gut microbiota alterations occur in end-stage renal disease (ESRD) patients with or without dialysis. However, it remains unclear whether changes in gut microbiota of dialysis ESRD patients result from dialysis or ESRD, or both. Similarly, there is a dearth of information on the relationship between gut microbiota and ESRD prognoses. We collected fecal samples and tracked clinical outcomes from 73 ESRD patients, including 33 pre-dialysis ESRD patients, 19 peritoneal dialysis (PD) patients, and 21 hemodialysis (HD) patients. 16S rRNA sequencing and bioinformatics tools were used to analyze the gut microbiota of ESRD patients and healthy controls. Gut microbiota diversity was different before and after dialysis. Bacteroidetes were significantly deceased in HD patients. Twelve bacterial genera exhibited statistically significant differences, due to dialysis (all P < 0.05, FDR corrected). HD reversed abnormal changes in Oscillospira and SMB53 in pre-dialysis patients. Functional predictions of microbial communities showed that PD and HD altered signal transduction and metabolic pathways in ESRD patients. Furthermore, Bacteroides and Phascolarctobacterium were associated with cardiovascular mortality. Dorea, Clostridium, and SMB53 were related to peritonitis in PD patients. This study not only demonstrated differences in gut microbiota between pre-dialysis and dialysis ESRD patients, but also firstly proposed gut bacteria may exert an impact on patient prognosis.