We developed a method to determine the pressure distribution in the electrode region of electrostatic accelerators. Direct measurement of this distribution is not possible: the electrodes are maintained inside a high pressure vessel and the presence of vacuum gauges would disturb the beam optics. The method is based on measuring the energy distribution of the atomic ion beams and identifying features associated to collisions with residual gas molecules. The procedure is also applicable to any other evacuated tube in the presence of a static longitudinal electric field. The feasibility of the method was verified in a 1.7 MV commercial particle accelerator using its facilities (accelerator tubes, particle beam, stripper, etc.). The measurements also revealed characteristics of the field structure inside the accelerator tube and the occurrence of leaks.