The invention relates to a method for preparing a thioamide-based chelating nanofiber for adsorbing heavy metal ions by combining an electrostatic spinning technology with a chemical grafting technology. The method comprises the following steps of: preparing a nanofiber from polyacrylonitrile which has high chemical stability, is easily subjected to electrospinning and is taken as an initiative raw material of reaction by the electrostatic spinning technology, pre-crosslinking, and performing thioamidation to prepare the chelating nanofiber for adsorbing the heavy metal ions. The fiber membrane of the prepared chelating nanofiber has good appearance, uniform diameter, high mechanical property, heat stability and solvent resistance, and high property of adsorbing the heavy metal ions such as gold, silver, lead, mercury, palladium, cadmium and the like. By the technology, the preparation process is simple, production equipment is low-cost, and the chelating nanofiber has low requirement on production conditions, and high properties, so the chelating nanofiber has high practical value, the content of the heavy metal ions which are produced due to industrial development and harm human health is reduced, and the chelating nanofiber has a wide application prospect for solving the livelihood problem.