The Ta/Dy/Ta nanostructures are fabricated by high-vacuum magnetron sputtering. Resistance and longitudinal magnetoresistance are measured. It is shown that the observed the effect of magnetic field on resistance are due to the competition of two effects of different nature. The negative isotropic magnetoresistance in the dysprosium layer is due to the alignment of local magnetic moments in the direction of the applied magnetic field. The positive longitudinal magnetoresistance in tantalum layers is caused by a change in the conditions of scattering of electrons during the accumulation of electrons with opposite spins on opposite surfaces of the metal film with strong spin-orbit coupling.