Background: Hepatitis B virus (HBV) infection has been reported to affect the bacterial characteristics in the host. We aimed to elucidate the compositional and functional characteristics of the microbiota in southern Chinese patients with coexistent HBV infection, non-alcoholic fatty liver disease (NAFLD), and type-2 diabetes mellitus (T2DM).Methods: Healthy controls (HCs) and patients with coexistent NAFLD and T2DM were enrolled. Patients were divided into two groups: N1 (without HBV infection) and N2 (with HBV infection). Stool samples were collected for 16s RNA gene sequencing and untargeted metabolomics analysis.Results: Bacterial diversity was decreased in the N2 group. There was a significantly lower abundance of bacteria of Faecalibacterium, Gemmiger, and Clostridium_XIVA genera, but a higher abundance of Megamonas and Phascolarctobacterium genera in the N2 group. Compared with the N1 group, the abundance of Gemmiger species was even lower, and alterations in the abundance of Phascolarctobacterium and Clostridium_XIVA genera only occurred in the N2 group. There were significantly different fecal metabolic features, which were enriched in glucose and lipid metabolic pathways (e.g., fatty acid and glycerophospholipid metabolism) between the N2 and HC groups. Metabolites in glycerophospholipid metabolism, such as Sn-3-o-(geranylgeranyl)glycerol1-phosphate, were even higher in the N2 group than in the N1 group. The decreased Faecalibacterium and Gemmiger contributed to the increased level of Sn-3-o-(geranylgeranyl) glycerol1-phosphate, palmitoylcarnitine, and serum triglycerides. Clostridium_XIVA species were positively correlated to 15(s)-hpete. Megamonas species were positively correlated with the serum level of glucose indirectly.Conclusions: The distinct gut-microbiome profile associated with HBV infection has a role in lipid metabolism and glucose metabolism in patients with coexistent NAFLD and T2DM.Clinical Trial Registration:www.ClinicalTrials.gov, identifier: NCT03525769.