A preparation method of N-2-pyrimidinyl-3-fluoroindole compound shown in formula (I), described method comprises the following steps: take acetonitrile solvent as reaction medium, add N shown in formula (III) ‑2‑pyrimidinyl indole compound, selectfluor, CuI and photocatalyst, react at room temperature under blue light irradiation for 2 to 5 hours, after the reaction is complete, the resulting reaction mixture is post-processed to obtain N‑2‑pyrimidinyl represented by formula (I) ‑3‑fluoroindoles. This type of compound is a kind of inhibitor compound that can significantly inhibit the activity of monoamine oxidase, especially I-2 and I-3 have high selectivity to MAO-A, which provides a research basis for the screening of antidepressant and anti-Parkinson drugs . The invention uses a photocatalyst to react under blue light irradiation and room temperature, has mild reaction conditions, high site selectivity, high reaction efficiency, greenness and environmental protection, and the reaction yield can reach 85%.