Recent advances in optical microscopy, such as total internal reflection and confocal scanning laser techniques, now permit the direct three-dimensional tracking of large numbers of colloidal particles both near and far from interfaces. A novel application of this technology, currently being developed by one of the authors under the name of diffusing colloidal probe microscopy (DCPM), is to use colloidal particles as probes of the energetic characteristics of a surface. A major theoretical challenge in implementing DCPM is to obtain the potential energy of a single particle in the external field created by the surface, from the measured particle trajectories in a dense colloidal system. In this paper we develop an approach based on an inversion of density-functional theory (DFT), where we calculate the single-particle-surface potential from the experimentally measured equilibrium density profile in a nondilute colloidal fluid. The underlying DFT formulation is based on the recent work of Zhou and Ruckenstein [Zhou and Ruckenstein, J. Chem. Phys. 112, 8079 (2000)]. For model hard-sphere and Lennard-Jones systems, using Monte Carlo simulation to provide the "experimental" density profiles, we found that the inversion procedure reproduces the true particle-surface-potential energy to an accuracy within typical DCPM experimental limitations (∼0.1kT) at low to moderate colloidal densities. The choice of DFT closures also significantly affects the accuracy.