The crystal and electronic structures, energy, kinetic, and magnetic characteristics of n -HfNiSn semiconductor heavily doped with a Lu acceptor impurity in the ranges T = 80–400 K and N A Lu ≈ 1.9 × 10 20 −1.9 × 10 21 cm −3 ( x = 0.01–0.10) at H ≤ 10 kG is studied. The nature of the structural-defect generation mechanism leading to changes in the band gap and the degree of semiconductor compensation is determined. Its essence is the simultaneous reduction and elimination of donor-type structural defects due to the displacement of ∼1% of Ni atoms from the Hf (4 a ) site, the generation of acceptor-type structural defects by substituting Ni atoms with Lu atoms at the 4 c site, and the generation of donor-type defects such as vacancies at the Sn (4 b ) site. The results of calculations of the electronic structure of Hf 1 − x Lu x NiSn are in agreement with experimental data. The results are discussed within the model of a heavily doped and compensated Shklovskii-Efros semiconductor.