  The effect of a spatially modulated magnetic field on the weak localization
phenomenon in two-dimensional electron gas (2DEG) is studied. Both the
dephasing time $\tau_H$ and magnetoresistance are shown to reveal a nontrivial
behavior as functions of the characteristics of magnetic field profiles. The
magnetic field profiles with rather small spatial scales $d$ and modulation
amplitudes $H_0$ such that $H_0d^2\ll\hbar c/e$ are characterized by the
dephasing rate $\tau_H^{-1}\propto H_0^2d^2$. The increase in the flux value
$H_0d^2$ results in a crossover to a standard linear dependence
$\tau_H^{-1}\propto H_0$. Applying an external homogeneous magnetic field $H$
one can vary the local dephasing time in the system and affect the resulting
average transport characteristics. We have investigated the dependence of the
average resistance vs the field $H$ for some generic systems and predict a
possibility to observe a positive magnetoresistance at not too large $H$
values. The resulting dependence of the resistance vs $H$ should reveal a peak
at the field values $H\sim H_0$.
