We present a new method for the determination of the surface properties of airless bodies from measurements of the emitted infrared flux. Our approach uses machine learning techniques to train, validate, and test a neural network representation of the thermophysical behavior of the atmosphereless body given shape model, illumination and observational geometry of the remote sensors. The networks are trained on a dataset of thermal simulations of the emitted infrared flux for different values of surface rock abundance, roughness, and values of the thermal inertia of the regolith and of the rock components. These surrogate models are then employed to retrieve the surface thermal properties by Markov Chain Monte Carlo Bayesian inversion of observed infrared fluxes. We apply the method to the inversion of simulated infrared fluxes of asteroid (101195) Bennu -according to a geometry of observations similar to those planned for NASA's OSIRIS-REx mission -and infrared observations of asteroid (25143) Itokawa. In both cases, the surface properties of the asteroid -such as surface roughness, thermal inertia of the regolith and rock component, and relative rock abundance -are retrieved; the contribution from the regolith and rock components are well separated. For the case of Itokawa, we retrieve a rock abundance of about 85% for pebbles larger than the diurnal skin depth, which is about 2 cm. The thermal inertia of the rock is found to be lower than the expected value for LL chondrites, indicating that the rocks on Itokawa could be fractured. The average thermal inertia of the surface is around 750 Js −1/2 K −1 m −2 and the measurement of thermal inertia of the regolith corresponds to an average regolith particle diameter of about 10 mm, consistently with in situ measurements as well as results from previous studies.