From the previous study by Inami and Sugimoto [Phys. Rev. Lett. 114, 246102 (2015)], it is known that a conventional frequency-modulation atomic force microscope (FM-AFM) system does not give an accurate contact potential difference (CPD) when it depends on the distance, and a novel method to measure an accurate CPD based on the energy dissipation was proposed. This method requires additional experimental setups to the conventional FM-AFM system to measure the energy dissipation. We propose the analytical method for the measurement of the distance dependence of the CPD with a conventional FM-AFM without additional setup which is based on evaluating the electrostatic force excluding the effect of the Casimir force and local charges.