PurposePublic debt forecasts represent a key policy issue. Many methodologies have been employed to predict debt sustainability, including dynamic stochastic general equilibrium models, the stock flow consistent method, the structural vector autoregressive model and, more recently, the neuro-fuzzy method. Despite their widespread application in the empirical literature, all of these approaches exhibit shortcomings that limit their utility. The present research adopts a different approach to public debt forecasts, that is, the random forest, an ensemble of machine learning.Design/methodology/approachUsing quarterly observations over the period 2000–2021, the present research tests the reliability of the random forest technique for forecasting the Italian public debt.FindingsThe results show the large predictive power of this method to forecast debt-to-GDP fluctuations, with no need to model the underlying structure of the economy.Originality/valueCompared to other methodologies, the random forest method has a predictive capacity that is granted by the algorithm itself. The use of repeated learning, training and validation stages provides well-defined parameters that are not conditional to strong theoretical restrictions This allows to overcome the shortcomings arising from the traditional techniques which are generally adopted in the empirical literature to forecast public debt.