Adsorption of hydrogen (H2) and nitrogen (N2) molecules was analyzed on a new fullerene–like C16Mg8O8 nano–cage, composed of magnesium, oxygen, and carbon, using density functional theory. A detailed analysis of the energy, geometry, and electronic structure of various H2 and N2 adsorptions on the cluster surface was performed. The adsorption energies of H2 and N2 were estimated to ranging from −0.16 to −0.52eV, respectively. The most stable adsorption configurations were those in which the H or N atoms of the adsorbates were located near the Mg atom of the cluster surface at different sides. It was found that the heterogeneous C16Mg8O8 nano–cluster selectively act against the H2 and N2 gaseous molecules. The electrical conductivity of the cluster, arising from HOMO/LUMO energy gap, was more sensitive to N2 gaseous molecule rather than H2 one, indicating that the heterogeneous C16Mg8O8 nano–cage may be potential nano–sensor for N2 molecule. These findings were specified by analyzing the characteristics in the electron density of states (DOS).