Numerous energetic electron precipitation events were recorded since 1963 in the atmosphere at polar latitudes in the course of regular measurements of charged particle fluxes in the Earth's atmosphere being performed by the Lebedev Physical Institute. The experimental data obtained represent the only uniform database in the world on electron precipitation events recorded directly in the atmosphere well below satellite orbits. The precipitating electrons are absorbed in the upper atmosphere. However, they generate X‐rays that can penetrate deep into the atmosphere sometimes down to altitudes of 20–35 km accessible to balloon measurements. These experimental data allow studying energy, temporal and spatial characteristics of electron precipitation events. In particular, based on PLANETOCOSMICS/GEANT4 we developed a method for evaluating the energy spectra of the primary flux of precipitating electrons. This method was used for evaluation of primary spectra of precipitating electrons assuming exponential energy distribution of incident electrons. Now, for the development of the method, we present the possibility of determining the energy spectra of electrons in the power‐law form, using new software RUSCOSMICS code. This new method, based on the GEANT4 software, makes it possible to describe the transport of precipitating electrons in the atmosphere taking into account the evolution of the energy and pitch‐angle distributions of electrons and X‐ray photons.