This study aimed to explore the alteration of bile acid (BA) profiles in patients with choledocholithiasis (CDC) and construct a prediction model for evaluating the risk of common bile duct stone (CBDS) recurrence after endoscopic treatment. A total of 320 patients (218 with CDC and 102 with nonneoplastic polyps) were enrolled. The serum BA profiles were compared between groups. Both diagnostic score of CDC and prognostic risk score of CBDS recurrence based on BAs were established by least absolute shrinkage and selection operator regression. A nomogram model was developed combining the risk score with clinical factors selected by Cox regression analysis. The BA profiles of patients with CDC were different from those of controls, which was mainly exhibited by an increase in conjugated BAs and the ratio of primary to secondary BA and a decrease in the hydrophobic BA ratio. The diagnostic model effectively distinguished patients with CDC from controls with an area under the curve of 0.763. Patients with CDC with a low BA risk score exhibited a high possibility of stone recurrence-free survival. The hazard ratios of history of cholecystectomy, multiple stones (n ≥ 2), bile duct angulation ≥132.7, and low BA risk score were 2.43, 4.18, 0.42, and 0.31, respectively. The serum BA profiles were altered in patients with CDC and could be used to distinguish patients with CDC from controls. The nomogram model developed for predicting the risk of CBDS recurrence in patients with CDC after endoscopic retrograde cholangiopancreatography treatment had high accuracy and clinical usability.