The utilization of agricultural wastes for textile dyeing has gained popularity due to their safe and environmentally friendly properties, as well as the resource sustainability. Natural dye extraction is usually achieved through solvent extraction, which is time-consuming, requires a lot of solvent, and degrades desired compounds at high temperatures. Thus, this study investigated ultrasound-assisted anthocyanin extraction from agricultural waste purple corn silk as natural functional colorants for hemp finishes, given the numerous health benefits associated with anthocyanin. In order to optimize the extraction processes and evaluate the synergistic impact of these conditions, response surface methodology was implemented. The optimum conditions were 1:15 material-liquid ratio, 47% ethanol concentration, 60°C, and 20 min, yielding 240.25 mg·L‒1 anthocyanin. The extracted anthocyanin was used for dyeing hemp fabrics and demonstrated satisfactory colorfastness, antibacterial action on both S.aureus and E.coli, with E.coli being more effective, and strong antioxidant (>80%). The dyed fabrics also exhibited their great UV shield (UPF value > 40+). Anthocyanin derived from purple corn silk could therefore be utilized as a natural functional color for medical and health products. Also, purple corn silk contains more anthocyanin than other natural sources, making it a promising natural anthocyanin resource in textile industry.