The structures, stabilities and electronic properties of endohedral and exohedral B38 fullerenes with transition metal atoms (M = Sc, Y, Ti, Nb, Fe, Co, Ni) are studied using all-electron density functional theory. M@B38 (M = Sc, Y, Ti) possess endohedral structures as their lowest energy structures, while Nb, Fe, Co and Ni atoms favor the coordination of B38 fullerenes in an exohedral manner. Sizable HOMO-LUMO gaps and high binding energies imply the viability of M@B38 towards experimental realization. The distributions of electron density and frontier orbitals are analyzed in detail. The analysis of vertical ionization potential and vertical electron affinity indicates that M@B38 are good electron acceptors and bad electron donors.