Road safety remains a major global concern, with human behaviour continuing to play a decisive role in serious traffic injuries and crashes. Although vehicle technologies and road infrastructure have improved considerably, risky driving practices such as speeding, distraction and impaired driving persist as primary contributing factors to accidents. This study investigates the prediction of hazardous driving behaviour through the analysis of more than 356,000 trips, emphasizing harsh acceleration and braking events as key indicators of driving risk. A comprehensive framework was developed to evaluate and classify driving behaviour into dangerous and non-dangerous categories. The proposed methodology integrates clustering techniques for defining safety levels, feature selection methods for identifying the most relevant variables and strategies for handling imbalanced datasets. Data obtained from a naturalistic driving experiment were analysed, with particular focus on harsh acceleration and braking patterns. Five machine learning models (Random Forest, Gradient Boosting, XGBoost, Multilayer Perceptron and K-Nearest Neighbors) were implemented to predict risky driving behaviour. The results indicated that Gradient Boosting and Multilayer Perceptron delivered the strongest predictive performance, achieving recall values of nearly 67% and 68% for harsh acceleration and braking events, respectively. Furthermore, the study identified critical safety thresholds of 48.82 harsh accelerations and 45.40 harsh braking events per 100 km. Overall, the integration of clustering methods, feature selection and machine learning models proved effective in detecting dangerous driving patterns. The proposed approach supports the development of personalized feedback systems, targeted driver training and advanced road safety strategies for authorities and transportation organizations.