Summary. We develop a technique for estimating the three-dimensional mass densities and gravitational potentials of rich clusters of galaxies. Formulae are presented for the cases of rotational and spherical symmetry and numerical tests of the procedure are described for the rotationally symmetric case - We find that with only 200 galaxies per cluster it is impossible usefully to estimate the three-dimensional mass densities of aspherical clusters by the transform technique we describe, but it is possible to obtain reasonable estimates of the gravitational potentials of such clusters. For spheroidal clusters, isothermal-b remsstrahlung model X-ray brightness distributions derived from potentials estimated with our technique from projected data agree, subject to 15 per cent statistical fluctuations, with brightness distributions obtained from the true potentials. We obtain good agreement between `deprojected' and `true' X-ray brightnesses whether or not the symmetry axis of the pseudo-cluster lies within the plane of the sky. The fit is however sensitive to whether the projected data are assumed to be those of a prolate or an oblate cluster.