Background Urban fires pose significant risks, resulting in substantial financial and human losses. Effective management of firefighting operations is crucial, where response times play a vital role in minimizing casualties and damages. This study aimed to utilize machine learning (ML) algorithms to accurately predict the operation time of firefighting in urban areas and to identify the most critical factors influencing this duration. Materials and method Data from 1402 firefighting operations in Ilam City, collected in 2022, were analyzed. After data preprocessing, which involved checking for duplicates and outlier detection, 1399 incidents were included for analysis. A total of 31 variables were initially examined, with 19 selected for the final models. Results The Generalized Linear Models (GLM) model demonstrated the lowest Root Mean Squared Error (RMSE) (95% CI: 14.21, +/- 1.65), indicating superior performance in estimating firefighting operation time. Key predictors identified included the number of personnel, rescue equipment, automobile fire engines, and manual extinguishers. GLM estimated the average operation time at 26.964 min (95% CI: 12.75-41.171). Conclusion The study highlights the effectiveness of ML in predicting firefighting operation times and emphasizes the importance of critical resources like personnel and equipment in achieving quicker response times. The findings have significant implications for urban fire management strategies aimed at reducing human and financial losses. Further research should enhance data collection efforts to improve prediction accuracy in firefighting operations.