Different sets of drivers underlie different safety behaviors, and uncovering such complex patterns helps formulate targeted measures to cultivate safety behaviors. Machine learning can explore such complex patterns among safety behavioral data. This paper aims to develop a classification framework for construction personnel’s safety behaviors with machine learning algorithms, including logistics regression (LR), support vector machine (SVM), random forest (RF), and categorical boosting (CatBoost). The classification framework has three steps, i.e., data collection and preprocessing, modeling and algorithm implementation, and optimal model acquisition. For illustrative purposes, five common safety behaviors of a random sample of Hong Kong-based construction personnel are used to validate the classification framework. To achieve high classification performance, this paper employed a combinative strategy, consisting of feature selection, synthetic minority over-sampling technique (SMOTE), one-hot encoding, standard scaler and classifiers to classify safety behaviors, and multi-objective slime mould algorithm (MOSMA) to optimize parameters in the classifiers. Results suggest that the combinative strategy of CatBoost–MOSMA achieves the highest classification performance with the maximum average scores, including area under the curve of receiver characteristic operator (AUC) ranging from 0.84 to 0.92, accuracy ranging from 0.80 to 0.86, and F1-score ranging from 0.79 to 0.86. From the optimal model, a unique set of important features was identified for each safety behavior, and ten out of the 46 input indicators were found important for all five safety behaviors. Based on the findings, this study advocates using the machine learning strategy of CatBoost–MOSMA in future construction safety behavior research and makes concrete and targeted suggestions to cultivate different construction safety behaviors.