For discharges in atmospheric pressure air, a numerical simulation of the process of formation of a runaway electron beam from the emission zone at the cathode was performed. The model is based on the numerical solution of the equations of motion of electrons injected from the surface of the emission zone and secondary electrons that appeared during gas ionization. It is shown that when a beam of runaway electrons passes through, a space charge is formed, which determines the electric field in the interelectrode gap.