The invention discloses a bioorganic fertilizer for adsorbing heavy metals and improving greenhouse soil. Raw materials of the bioorganic fertilizer comprise, by weight, 83-88 parts of a decomposed organic fertilizer, 8-12 parts of biochar, 1-2 parts of attapulgite, 2-3 parts of functional bacteria, and 0.5-1 part of methyl salicylate, wherein raw materials of the decomposed organic fertilizer comprise, by weight, 45-60 parts of straws, 30-45 parts of traditional Chinese medicinal residues, 1-5 parts of a urea fertilizer with the nitrogen content of 46wt%, 1-2 parts of a straw fermentation inoculant, 1-2 parts of penicillium oxalicum and 0.5-1 part of brown sugar. The content of organic matters in the bioorganic fertilizer is not lower than 30%, the quantity of effective live bacteria in the bioorganic fertilizer is not lower than 0.02 billions/g, and the bioorganic fertilizer can effectively enrich heavy metals in soil and reduces the content of the heavy metals; and functional bacteria and methyl salicylate can dually defense internally and externally, can effectively inhibit breeding and invasion of root-knot nematodes, also can improve the structure of soil, increases the permeability, improves the pH value, and reaches yield increase, quality improvement and environmental protection.