Building a reliable soil model is a prerequisite for accurately calculating the ground potential distribution of the grounding grid. Research shows that the soil electrical parameters are frequency‐dependent, so frequency domain inversion of soil parameters should consider the soil inhomogeneity and the frequency characteristic of parameters. A method for retrieving parameters of horizontal multilayer soil model is proposed. The theoretical formula of apparent complex resistivity with considering dynamic state electromagnetic field theory is derived from Green's function. Discrete dynamic state complex image method is introduced to solve the infinite integral in Green's function. Ant colony optimization algorithm is applied to optimize the inversion process of soil parameters. In the first stage, applicability of this method is confirmed by interpreting field data under DC field. DC parameters including DC resistivity, thickness and number of layer are determined. The performance of different optimization algorithms in terms of computational efficiency is compared at this stage. In the second stage, soil resistivity and relative dielectric constant are retrieved by inverting frequency domain experimental data. Different representations based on quasi‐static electromagnetic field and dynamic state electromagnetic field theories are taken into account. The frequency characteristic of soil parameters is concluded by discussing the inversion results. In the study of parameter inversion of horizontal multi‐layer soil model, our method has shown strong performance in computational efficiency and accuracy of inversion results.