We determine Mg abundances in 6 Gaia benchmark stars using theoretical one-dimensional ( 1D ) hydrostatic model atmospheres , as well as temporally- and spatially-averaged 3D model atmospheres ( \langle { 3 D } \rangle ) . The stars cover a range of T _ { \text { eff } } from 4700 to 6500 \mathrm { K } , \log { g } from 1.6 to 4.4 \mathrm { dex } , and \mathrm { \left [ Fe / H \right ] } from -3.0 \mathrm { dex } to solar . Spectrum synthesis calculations are performed in local thermodynamic equilibrium ( LTE ) and in non-LTE ( NLTE ) using the oscillator strengths recently published by Pehlivan Rhodin et al . We find that : a ) Mg abundances determined from the infrared spectra are as accurate as the optical diagnostics , b ) the NLTE effects on Mg i line strengths and abundances in this sample of stars are minor ( although for a few Mg i lines the NLTE effects on abundance exceed 0.6 \mathrm { dex } in \langle { 3 D } \rangle and 0.1 \mathrm { dex } in 1D , c ) the solar Mg abundance is 7.56 \pm 0.05 \mathrm { dex } ( total error ) , in the excellent agreement with the Mg abundance measured in CI chondritic meteorites , d ) the 1D NLTE and \langle { 3 D } \rangle NLTE approach can be used with confidence to analyse optical Mg i lines in spectra of dwarfs and sub-giants , but for red giants the Mg i 5711 Å line should be preferred , e ) low-excitation Mg i lines are sensitive to the atmospheric structure ; for these lines , LTE calculations with \langle { 3 D } \rangle models lead to significant systematic abundance errors . The methods developed in this work will be used to study Mg abundances of a large sample of stars in the next paper in the series .