Precast ultra-high-performance concrete (UHPC) structures (PUSs) have gained increasing research and application interest in civil engineering owing to the combination of advanced construction materials and methods. UHPC joints are critical parts of PUSs; thus, an accurate prediction of their shear capacity (SC) is essential to ensure structural safety and reliability. However, existing equations for predicting SC have limited accuracy and applicability owing to their simplified assumptions and restricted input parameters. To address these challenges, this study used machine learning (ML) approaches to develop a unified and accurate predictive model for various types of UHPC joints. A well-curated database containing 218 UHPC joints with diverse types and configurations was established. Six ensemble algorithms and four traditional algorithms were employed to develop predictive models, and eight existing equations were compared for performance evaluation. Both correlation-based and SHAP-based feature selection methods were used to optimize the model accuracy. The ensemble algorithms demonstrated better performance than the traditional individual algorithms, with the gradient boosting machine (GBM) model ranked as the best ML model for SC. The ML model outperformed existing equations in all evaluated metrics, demonstrating its accuracy and robustness. Furthermore, Shapley Additive exPlanations (SHAP) analysis was employed to interpret the ML model, thereby providing insights into influential features and their relationships. These findings demonstrate the advantages of ML methods in predicting the SC of UHPC joints and provide valuable guidance for the structural design and research on PUSs.