CONTEXT: In recent years, the solar chemical abundances have been studied in considerable detail because of discrepant values of solar metallicity inferred from different indicators, i.e., on the one hand, the sub-solar photospheric abundances resulting from spectroscopic chemical composition analyses with the aid of 3D hydrodynamical models of the solar atmosphere, and, on the other hand, the high metallicity inferred by helioseismology. AIMS: After investigating the solar oxygen abundance using a CO5BOLD 3D hydrodynamical solar model in previous work, we undertake a similar approach studying the solar abundance of nitrogen, since this element accounts for a significant fraction of the overall solar metallicity, Z. METHOD: We used a selection of atomic spectral lines to determine the solar nitrogen abundance, relying mainly on equivalent width measurements in the literature. We investigate the influence on the abundance analysis, of both deviations from local thermodynamic equilibrium (NLTE effects) and photospheric inhomogeneities (granulation effects). RESULTS: We recommend use of a solar nitrogen abundance of A(N)=7.86+-0.12 whose error bar reflects the line-to-line scatter. CONCLUSION: The solar metallicity implied by the CO5BOLD-based nitrogen and oxygen abundances is in the range 0.0145<= Z <= 0.0167. This result is a step towards reconciling photospheric abundances with helioseismic constraints on Z. Our most suitable estimates are Z=0.0156 and Z/X=0.0213.