Heatwaves can greatly impact societies, underscoring the need to extend current heatwave prediction lead times. This study investigates multiple machine learning (ML) model approaches for heatwave occurrence prediction with long lead times of one to five months. Five ML classifiers, built using Google Earth Engine remote sensing datasets, are developed and tested for heatwave prediction for the national scale (case example of Sweden) over time period 1989–2019. The ML modelling is based on 13 final explanatory atmospheric and landscape features. The balanced random forest model exhibits the consistently best performance among the tested ML models, stable across all investigated lead times (from one to five months) with balanced accuracy of around 0.77, even though not overall identifying actual heatwave occurrence (decreased recall for heatwave occurrence from 0.87 to 0.81). Application of SHapley Additive exPlanations technique for model interpretation shows increasing importance of model output with increasing lead time for landscape features such as runoff and soil water. Overall, more frequent heatwave occurrence emerges for places characterized by lower values of geopotential height, evaporation, precipitation, and topographical slope, and higher values of temperature, runoff, and sea level pressure. The study also exemplifies how the developed ML modelling approach could be used to identify and warn for early signs of forthcoming heatwave occurrence, and further step-wise improve the identification and warning toward less uncertainty for shorter lead times. This can facilitate earlier warning in support of better planning of measures to mitigate adverse heatwave impacts, up to several months ahead of their possible occurrence.