Lattice energy of a crystal is defined as the energy required to break an ionic crystal into its constituent ions in an isolated gaseous state. More ionic the compound is stronger will be its ionic bond and higher will be its lattice energy.
In MgN3 the charge on the ionic species is greater than NaCl. So, ionic interactions in MgN3 will be stronger.
So, lattice energy of MgN3 is greater than NaCl