A large sample of MgII emitting star-forming galaxies with low metallicity [O/H] = log(O/H)-log(O/H)sun between -0.2 and -1.2 dex is constructed from Data Release 14 of the Sloan Digital Sky Survey. We selected 4189 galaxies with MgII 2797, 2803 emission lines in the redshift range z~0.3-1.0 or 35% of the total Sloan Digital Sky Survey star-forming sample with redshift z>0.3. We study the dependence of the magnesium-to-oxygen and magnesium-to-neon abundance ratios on metallicity. Extrapolating this dependence to [Mg/Ne]=0 and to solar metallicity we derive a magnesium depletion of [Mg/Ne]~-0.4 (at solar metallicity). We prefer neon instead of oxygen to evaluate the magnesium depletion in the interstellar medium because neon is a noble gas and is not incorporated into dust, contrary to oxygen. Thus, we find that more massive and more metal abundant galaxies have higher magnesium depletion. The global parameters of our sample, such as the mass of the stellar population and star formation rate, are compared with previously obtained results from the literature. These results confirm that MgII emission has a nebular origin. Our data for interstellar magnesium-to-oxygen abundance ratios relative to the solar value are in good agreement with similar measurements made for Galactic stars, for giant stars in the Milky Way satellite dwarf galaxies, and with low-metallicity damped Lyman-alpha systems.