In this study, the electronic structures and magnetic and optical properties of Mg2Ge doping with transi. tion metal elements X (X=Sc, Cr, and Mn) were investigated by density functional theory (DFT). The lattice con. stants, band structures, density of states, and optical parameters were calculated for all compounds. The results show that the Fermi level of Mg2Ge can enter into the conduction band after doping with Sc, and Mg2Ge turns into an n. type degenerate semiconductor. It can lead to spin splitting of the band structure and density of states of Mg2Ge near Fermi level after doping with Cr and Mn, resulting in a net magnetic moment, which is shown as a semi.metal. lic magnet and dilute magnetic semiconductor. The net magnetic moment of the system is derived from the 3d orbit. al electrons of impurity atoms and their induced polarization of Ge4p state and Mg2p state spintronics. Compared with the intrinsic Mg2Ge, the doping systems have an improvement in the static permittivity, which indicates that the photocatalytic activity of Mg2Ge is enhanced. In terms of the absorption coefficient, the compounds with impurity atoms extend the absorption range, and the best enhancement appears near.infrared band.