The invention discloses an organic fertilizer with an insect expelling function. The organic fertilizer is prepared from the following raw materials in parts by weight: 5-6 parts of Chinese honey locust, 150-155 parts of fresh sheep manure, 10-15 parts of soybeans, 1-2 parts of garlic, 1-2 parts of clove, 1-2 parts of oil residues, 10-20 parts of waste fruit, melon and vegetable peel, 10-20 parts of fish meal, 5-7 parts of radish peel, 1-2 parts of cassava alcohol residues, 4-6 parts of castor cakes, 5-7 parts of poria cocos, 4-6 parts of astragalus membranaceus, 1-2 parts of pepper leaves, 0.01-0.02 part of trichlorfon, 1-2 parts of red-spotted stonecrop, 2-6 parts of typhonium giganteum, 1-2 parts of radix aconiti agrestis and 0.4-0.5 part of an EM fungicide. The organic fertilizer is prepared through secondary fermentation treatment, is easy in obtaining raw materials, is convenient to use, comprehensive in nutrition, has the functions of yield increase and insect expelling, can do no harm to the soil environment, and is free of pollution or agricultural residues.