The invention provides a magnetic field sensor based on an organic field effect transistor and a preparation method thereof, and belongs to the technical field of sensors and preparation thereof. Themagnetic field sensor sequentially comprises a substrate, a gate electrode, a dielectric layer, an organic semiconductor layer, a source electrode, a drain electrode and a packaging layer from bottomto top. The organic semiconductor layer comprises a mixed material of a magnetic nano material and an organic semiconductor material, and the content of the magnetic nano material is 0.1-1wt%. The magnetic field sensor has high sensitivity to magnetic field signals, the manufacturing cost is low, the service life of the magnetic field sensor is prolonged; the preparation of a high-stability deviceis realized, magnetic field transistors with different magnetic field intensities and sensitive response can be manufactured according to requirements, detection of magnetic fields with various intensities can be realized, the application range is broadened, and the magnetic field sensor has huge potential in flexible, miniature, bionic and disposable human body electronic devices, and finally, the prepared magnetic field sensor structure based on the organic field effect transistor has the characteristics of simple structure, miniaturization and portability.