Discriminating depressive episodes of bipolar disorder (BD) from major depressive disorder (MDD) is a major clinical challenge. Recently, gut microbiome alterations are implicated in these two mood disorders; however, little is known about the shared and distinct microbial characteristics in MDD versus BD. Here, using 16S ribosomal RNA (rRNA) gene sequencing, the microbial compositions of 165 subjects with MDD are compared with 217 BD, and 217 healthy controls (HCs). It is found that the microbial compositions are different between the three groups. Compared to HCs, MDD is characterized by altered covarying operational taxonomic units (OTUs) assigned to the Bacteroidaceae family, and BD shows disturbed covarying OTUs belonging to Lachnospiraceae, Prevotellaceae, and Ruminococcaceae families. Furthermore, a signature of 26 OTUs is identified that can distinguish patients with MDD from those with BD or HCs, with area under the curve (AUC) values ranging from 0.961 to 0.986 in discovery sets, and 0.702 to 0.741 in validation sets. Moreover, 4 of 26 microbial markers correlate with disease severity in MDD or BD. Together, distinct gut microbial compositions are identified in MDD compared to BD and HCs, and a novel marker panel is provided for distinguishing MDD from BD based on gut microbiome signatures.