While the precise triggers of gallstone formation remain incompletely understood, it is believed to arise from a complex interplay of genetic and environmental factors. The bile microbiome is being increasingly recognized as a possible contributor to the onset of gallstone disease. The primary objective of this study was to investigate distinctions in the microbial communities within bile specimens from patients with choledocholithiasis (common bile duct stones) and cholecystolithiasis (gallbladder stones). We employed massively parallel sequencing of the 16S rRNA gene to examine the microbial communities within bile samples obtained from 28 patients with choledocholithiasis (group DS) and cholecystolithiasis (group GS). The taxonomic composition of the bile microbial communities displayed significant disparities between the group DS and the group GS. Within the 16 prevalent genera, only Streptococcus, Ralstonia, Lactobacillus, and Enterococcus were predominantly found in the group GS. In contrast, the group DS displayed a more diverse range of genera. The alpha diversity of bile specimens was also notably lower in the group GS compared to the group DS (p = 0.041). Principal coordinate analysis unveiled distinct clustering of bile microbial communities depending on the location of the gallstone. Linear discriminant analysis effect size analysis, with a score threshold of >3 and the Kruskall–Wallis test (α < 0.05), recognized Bacilli and Lactobacillales as potential taxonomic markers for distinguishing patients with cholecystolithiasis limited to the gallbladder. Significant variations were found in the distribution and diversity of bile microbial communities between patients with choledocholithiasis and cholecystolithiasis. This observation suggests that alterations in the bile microbiome may contribute to the development of gallstones in these patients.