Distracted driving significantly affects the efficiency and safety of traffic flow. Modeling distracted driving behavior in microscopic traffic flow simulation is essential for understanding its critical impacts on traffic flow. However, due to the influence of various external factors and the considerable uncertainties in behavior characteristics, modeling distracted driving behavior remains a challenge. This study proposed a model which incorporates distraction features into the microscopic traffic flow model to simulate distracted driving behavior. Specifically, the study first examines the characteristics of distracted driving, including the intervals and durations of distraction events, as well as the patterns and environments of distraction. It then introduces distraction parameters into the Intelligent Driver Model (IDM), including reaction time delays and perception deviations in both speed difference and following distance. These parameters are quantified by probabilistic distributions to reflect the uncertainty and individual differences in driving behavior. The model is calibrated and validated using 772 distracted following events from the Shanghai Naturalistic Driving Study (SH-NDS) data. Three patterns of distraction (excessive, moderate, mild) are distinguished and modeled separately. The results show that the model’s accuracy surpasses that of the IDM under various road types and traffic volumes, with an average improvement in model accuracy of about 11.30% on expressways with high traffic volume, 4.54% on expressways with low traffic volume, and 4.46% on surface roads. Meanwhile, the model can effectively simulate the variations in reaction times and perceptual deviations in both speed and following distance for different distraction modes at the individual level, maintaining consistency with reality. Finally, the study simulates distracted driving behavior under different road environments and traffic volumes to explore the impact of distracted driving on traffic flow. The simulation results indicate that an increase in the proportion of distraction reduces the efficiency and safety of traffic flow, which is consistent with real-world observations. Since the model considers human distraction factors, it can generate more dangerous driving scenarios in simulations, which holds significant importance for safety-related research. The findings from this study are expected to be helpful for understanding distracted driving behavior and mitigate its negative influence on the efficiency and safety of traffic flow.