We study the role played by the magnetic dipole interaction in an atomic interferometer based on an alkali Bose-Einstein condensate with tunable scattering length. We tune the s-wave interaction to zero using a magnetic Feshbach resonance and measure the decoherence of the interferometer induced by the weak residual interaction between the magnetic dipoles of the atoms. We prove that with a proper choice of the scattering length it is possible to compensate for the dipolar interaction and extend the coherence time of the interferometer. We put in evidence the anisotropic character of the dipolar interaction by working with two different experimental configurations for which the minima of decoherence are achieved for a positive and a negative value of the scattering length, respectively. Our results are supported by a theoretical model we develop. This model indicates that the magnetic dipole interaction should not represent a serious source of decoherence in atom interferometers based on Bose-Einstein condensates.