An ab initio density functional theory (DFT) study with correction for dispersive interactions was performed to study the adsorption of N(2) and CO(2) inside an (8, 8) single-walled carbon nanotube. We find that the approach of combining DFT and van der Waals correction is very effective for describing the long-range interaction between N(2)/CO(2) and the carbon nanotube (CNT). Surprisingly, exohedral doping of an Fe atom onto the CNT surface will only affect the adsorption energy of the quadrupolar CO(2) molecule inside the CNT (20-30%), and not that of molecular N(2). Our results suggest the feasibility of enhancement of CO(2)/N(2) separation in CNT-based membranes by using exohedral doping of metal atoms.