The spin-polarized transport is investigated in a magnetic tunnel junction which consists of two ferromagnetic electrodes separated by a magnetic barrier and a nonmagnetic metallic spacer placed in distance above the two dimensional electron gas (2DEG) in presence of an inhomogeneous external modulated magnetic field and a perpendicular wave vector dependent effective potential. Based on the transfer matrix method and the nearly-free-electron approximation the dependence of the conductance and spin polarization on the Fermi energy of the electrons are studied theoretically the. strong oscillations with large amplitude investigated in spin polarization in terms of the Fermi energy due to the inhomogeneous magnetic field. The conductance in terms of the Fermi energy shows no oscillation in low energy but has a strong pick in middle region. this results may be useful for the development of spin electronic devices based on coherent transport, or may be used as a tunable spin-filter.