Up to 40% of transplant recipients treated long-term with tacrolimus (TAC) develop post-transplant diabetes mellitus (PTDM). TAC is an important risk factor for PTDM, but is also essential for immunosuppression after transplantation. Long-term TAC treatment alters the gut microbiome, but the mechanisms of TAC-induced gut microbiota in the pathogenesis of PTDM are poorly characterized. Here, we showed that vancomycin, an inhibitor of bacterial beta-glucuronidase (GUS), prevents TAC-induced glucose disorder and insulin resistance in mice. Metagenomics shows that GUS-producing bacteria are predominant and flourish in the TAC-induced hyperglycemia mouse model, with upregulation of intestinal GUS activity. Targeted metabolomics analysis revealed that in the presence of high GUS activity, the hydrolysis of bile acid (BAs)-glucuronic conjugates is increased and most BAs are overproduced in the serum and liver, which, in turn, activates the ileal farnesoid X receptor (FXR) and suppresses GLP-1 secretion by L-cells. The GUS inhibitor vancomycin significantly eliminated GUS-producing bacteria and inhibited bacterial GUS activity and BAs levels, thereby enhancing L-cell GLP-1 secretion and preventing hyperglycemia. Our results propose a novel clinical strategy for inhibiting the bacterial GUS enzyme to prevent hyperglycemia without requiring withdrawal of TAC treatment. This strategy exerted its effect through the ileal bile acid-FXR-GLP-1 pathway.