The invention provides preparation and application of boat-fruited sterculia seed residue based sulfur-doped porous carbon. The preparation comprises the following steps: subjecting tea-made boat-fruited sterculia seed residues, which serve as a raw material, and a sulfur dopant to high-temperature carbonization in an inert atmosphere so as to obtain sulfur-doped carbon, and then, carrying out physical activating treatment, thereby obtaining the sulfur-doped porous carbon. According to the preparation and the application, the sulfur-doped porous carbon is prepared by adopting a high-temperature carbonization and physical activation combined method, the method is simple in operation, the process is easy to control, washing is not required after activation, the production cost is reduced, the carbon yield is relatively high, and the method is environmentally friendly; and the prepared sulfur-doped porous carbon is of a nanosheet structure, is controllable in specific surface area and pore size distribution, high in electric conductivity and adjustable in sulfur content and is particularly suitable for being applied to the fields of heavy-metal wastewater treatment, printing and dyeing wastewater adsorption, lithium-sulfur batteries, lithium-ion batteries, sodium-ion batteries, supercapacitors, catalyst loading and the like.