Step 1: Identify nitrogen as diatomic and find $C_P$.
Nitrogen (N$_2$) is diatomic with 5 degrees of freedom. Equipartition gives $C_P = \frac{7R}{2}$.
Step 2: Write the heat equation at constant pressure and rearrange for $n$.
$Q = nC_P\Delta T \Rightarrow n = \frac{2Q}{7R\Delta T}$.
Step 3: Substitute values to find $n$.
$Q = 498$ J, $\Delta T = 40$ K, $R = 8.3$ J mol$^{-1}$K$^{-1}$: \[ n = \frac{2 \times 498}{7 \times 8.3 \times 40} = \frac{996}{2324} \approx 0.4286 \text{ mol} \]
Step 4: Convert moles to mass.
Molar mass of N$_2$ $= 28$ g/mol: \[ m = 0.4286 \times 28 \approx 12 \text{ g} \]
Step 5: Verify by substituting back.
$Q = \frac{12}{28} \times \frac{7 \times 8.3}{2} \times 40 \approx 498$ J. Confirmed.
Step 6: State the final answer.
\[ \boxed{m = 12 \text{ g}} \]