Context. The formation history and evolution of the Milky Way through cosmological time is a complex field of research requiring the sampling of highly accurate stellar ages for all Galaxy components. Such highly reliable ages are starting to become available thanks to the synergy of asteroseismology, spectroscopy, stellar modelling, and machine learning analysis in the era of all-sky astronomical surveys. Aims. Our goal is to provide an accurate list of ages for the Main Red Star Sample of the APOGEE DR17 catalogue. In order to reach this goal, ages obtained under asteroseismic constraints are used to train a machine learning model. Methods. As our main objective is to obtain reliable age predictions without the need for asteroseismic parameters, the optimal choice of stellar non-asteroseismic parameters was investigated to obtain the best performances on the test set. The stellar parameters Teff and L, the abundances of [CI/N],[Mg/Ce], and [α/Fe], the U(LSR) velocity, and the vertical height from the Galactic plane ‘Z’ were used to predict ages with a categorical gradient boost decision trees model. The model was trained on two merged samples of the TESS Southern Continuous Viewing Zone and the Second APOKASC catalogue to avoid a data shift and to improve the reliability of the predictions. Finally, the model was tested on an independent data set of the K2 Galactic Archaeology Program. Results. A model with a median fractional age error of 20.8% is obtained. Its prediction variance between the validation and the training set is 4.77%. For stars older than 3 Gyr, the median fractional error in age ranges from 7% to 23%. For stars with ages ranging from 1 to 3 Gyr, the median fractional error in age ranges from 26% to 28%. For stars younger than 1 Gyr, the median fractional error is 43%. The optimised model applies to 125 445 stars from the Main Red Star Sample of the APOGEE DR17 catalogue. Our analysis of the ages confirms previous findings regarding the flaring of the young Galactic disc towards its outer regions. Additionally, we find an age gradient among the youngest stars within the Galactic plane. Finally, we identify two groups of a few metal-poor ([Fe/H] < −1 dex) young stars (Age < 2 Gyr) with similar peculiar chemical abundances and halo kinematics. These are likely the outcomes of the predicted third and latest episode of gas infall in the solar vicinity (~2.7 Gyr ago). Conclusions. We make a catalogue of asteroseismically calibrated ages for 125 445 red giants from the APOGEE DR17 catalogue available to the community. The analysis of the associated stellar parameters corroborates the predictions of different literature models.