Cholangiocarcinoma (CCA) is a malignant hepatic tumor with a poor prognosis, which needs early diagnosis urgently. The gut microbiota has been shown to play a crucial role in the progression of liver cancer. Here, we explored a gut microbiota model covering genera Burkholderia-Caballeronia-Paraburkholderia, Faecalibacterium, and Ruminococcus_1 (B-F-R) for CCA early diagnosis. A case-control study was conducted to enroll 53 CCA patients, 47 cholelithiasis patients, and 40 healthy controls. The feces samples and clinical information of participants were collected in the same period. The gut microbiota and its diversity of individuals were accessed with 16S rDNA sequencing, and the gut microbiota profile was evaluated according to microbiota diversity. Finally, four enriched genera in the CCA group (genera Bacteroides, Muribaculaceae_unclassified, Muribaculum, and Alistipes) and eight enriched genera in the cholelithiasis group (genera Bifidobacterium, Streptococcus, Agathobacter, Ruminococcus_gnavus_group, Faecalibacterium, Subdoligranulum, Collinsella, Escherichia-Shigella) constitute an overall different microbial community composition (P = 0.001). The B-F-R genera model with better diagnostic value than carbohydrate antigen 19-9 (CA19-9) was identified by random forest and Statistical Analysis of Metagenomic Profiles (STAMP) to distinguish CCA patients from healthy controls [area under the curve (AUC) = 0.973, 95% CI = 0.932–1.0]. Moreover, the correlative analysis found that genera Burkholderia-Caballeronia-Paraburkholderia were positively correlated with body mass index (BMI). The significantly different microbiomes between cholelithiasis and CCA were found via principal coordinates analysis (PCoA) and linear discriminant analysis effect size (LEfSe), and Venn diagram and LEfSe were utilized to identify four genera by comparing microbial compositions among patients with malignant obstructive jaundice (MOJ-Y) or not (MOJ-N). In brief, our findings suggest that gut microbiota vary from benign and malignant hepatobiliary diseases to healthy people and provide evidence supporting gut microbiota to be a non-invasive biomarker for the early diagnosis of CCA.