First-principles calculations were conducted to investigate the structural, electronic and magnetic properties of single Fe atoms and Fe dimers on Cu2N/Cu(100). Upon adsorption of an Fe atom onto Cu2N/Cu(100), robust Fe-N bonds form, resulting in the incorporation of both single Fe atoms and Fe dimers within the surface Cu2N layer. The partial occupancy of Fe-3d orbitals lead to large spin moments on the Fe atoms. Interestingly, both single Fe atoms and Fe dimers exhibit in-plane magnetic anisotropy, with the magnetic anisotropy energy (MAE) of an Fe dimer exceeding twice that of a single Fe atom. This magnetic anisotropy can be attributed to the predominant contribution of the component along the x direction of the spin-orbital coupling Hamiltonian. Additionally, the formation of Fe-Cu dimers may further boost the magnetic anisotropy, as the energy levels of the Fe-3d orbitals are remarkably influenced by the presence of Cu atoms. Our study manifests the significance of uncovering the origin of magnetic anisotropy in engineering the magnetic properties of magnetic nanostructures.