Machine learning approaches are attracting more attention in predicting the economic optimum nitrogen rate (EONR) for field crop production. However, the robustness in fertilizer recommendations appeared to be less responsive to extreme abiotic stress conditions, due to the lack of post-fertilization seasonal weather information. This study employed four machine learning models, namely, support vector machine (SVM), gradient boosting (GB), random forest (RF), and ridge regression (RR) to predict the site-specific EONR values of canola crops, based on a 22-site-year field study across eastern Canada. Model performance was assessed using the 'leave-one-out' approach under three scenarios, i.e., different combinations of input variables, including current seasonal weather data before N topdressing, 10-year historical weather records, and field management and crop traits. Results of this study showed that including historical weather data highly improved prediction accuracy for EONR in a variety of canola growing environments. The RF model outperformed other models in predicting site-specific EONRs, with a Pearson correlation coefficient of 0.9, a standard deviation of 23 kg N ha−1 and a relative error of 2%. For 16 of the 22 test environments, the EONR predicted using RF fell within its confidence range, indicating that the prediction has a 73% chance of being an acceptable recommendation. Overall, incorporating historical weather data is essential for successfully predicting crop N requirements under normal and stressful growing conditions. The results indicate that with a base fertilizer of 50 kg N ha−1, the recommended topdressing application rate varied from 50 to 110 kg N ha−1 in moist seasons, but decreased to 20–50 kg N ha−1 in hot and dry years, for sustainable canola production in eastern Canada. Appropriately incorporating historical weather data and soil properties into machine learning-based algorithms can be used to precisely guide fertilizer N management on canola crops under diverse climatic stress conditions. This approach promises to optimize seed yield and reduce nitrogen losses to the environment for sustainable canola production in Canada. • Four machine learning models were compared to predict economic optimum nitrogen rate (EONR). • Historical weather conditions were essential to predict the site-specific EONR. • Random forest model performed the best in recommending EONR by integrating weather data, field management and crop features. • A rate of 50 kg N ha−1 at planting plus 20–110 kg N ha−1 at the 4–6 leaf stage is recommended for canola production. [ABSTRACT FROM AUTHOR]