The structural, electronic, and magnetic properties of seven sets of SrTiO2.75 (oxygen vacancies) and SrTiO2.75N0.25 (nitrogen doping) models were investigated by the first principles calculations based on density functional theory. Our results indicated that oxygen vacancies tended to align in a chain sandwiched with Ti atoms, whereas doped nitrogen atoms (substituting oxygen atoms in SrTiO3) preferred other arrangements rather than a chain. In addition, under stable arrangement, SrTiO2.75 showed no magnetism, whereas magnetic moments appeared in other meta-stable SrTiO2.75 configurations as well as in SrTiO2.75N0.25, which is attributed to the Ti 3d orbitals and nitrogen p orbitals, respectively. Our results suggest a possible route for tuning magnetic and electronic properties of SrTiO3 by atomic design.