The invention discloses a method for preparing an environment-friendly electronic substrate solder, and belongs to the technical field of solders. According to the method, lac is adopted as a raw material, hydrogen peroxide is added to be mixed, impurities are removed, then water and sodium carbonate are added for oscillation, and then centrifugation is carried out; supernate is collected, peptone, dipotassium phosphate and the like are added for stirring, a culture medium is prepared, inoculated culture is carried out through mould, and then auxiliary materials are added for fermentation to obtain mixed acid; and the mixed acid is mixed with the supernate, finally ascorbic acid, sodium dodecyl benzene sulfonate and the like are added for constant-temperature oscillation, and the environment-friendly electronic substrate solder is obtained after cooling. The lac is adopted as the raw material, compatibility and cohesiveness are good, the defect that a traditional solder is poor in welding performance is overcome, the raw material is easy to obtain, environment friendliness is achieved, and wide application prospects are achieved.