The study shows that the effect of azimuthal deflection of ions in an accelerator beam with a closed azimuthal electron drift can be used to control the shape of the ion beam and the profile of the ion current density distribution along the radius. By varying the distribution profile of the magnetic field along the axis of the accelerating channel, it is possible to control the ion current density profile, giving it both an annular shape and a shape close to the Gaussian distribution. We propose a criterion for calculating the magnetic system providing the best focusing of the ion beam. Findings of the research show that from the known distribution of the magnetic field with the optimal focusing of the ion beam, one can estimate the position of the ionization zone in the accelerating channel