The present study proposed a real-time traffic safety evaluation framework using macroscopic flow variables. To this end, open-access extended vehicle trajectories were employed. Rear-end traffic conflicts and macroscopic traffic flow variables were derived from the trajectory data and were integrated for real-time safety evaluation. The Proportion of Stopping distance ( PSD) accounts for all types of interactions (both safe and unsafe) in the traffic stream; therefore, the same was adopted to analyze the rear-end traffic conflicts. A macroscopic indicator termed “time spent in conflict ( TSC)” was derived to evaluate the rear-end traffic conflicts. Machine learning models, namely, Random Forest (RF), Support Vector Machines (SVM), and eXtreme Gradient Boosting (XGB), were employed to predict TSCs using macroscopic traffic flow variables. The results revealed that the TSC computed based on PSD exhibits a reliable and explainable relationship with the macroscopic traffic flow variables. TSC computed based on PSD revealed that intermediately congested traffic flow conditions are critical in traffic safety and can be attributed to complex traffic phenomena such as traffic hysteresis, traffic oscillations, and increased speed variance. Moreover, a stable relation between traffic safety and traffic flow was suggested for varying threshold values. Among different machine learning models, the RF model was observed as the best-fitted model to predict TSC based on macroscopic traffic variables. TSC quantifies the safety status of a given traffic flow condition, where a higher value of TSC for a particular traffic flow condition indicates that vehicles prevail in the conflicting scenario for a longer time and, therefore, reflect higher operational risk. The developed machine learning model can be employed to predict TSC (operational risk) in real time using the macroscopic traffic flow variables and, therefore, facilitate traffic safety monitoring.