Melatonin is a natural hormone that has functions such as circadian rhythm regulation, neuroregulation and cardiac protection, as well as antifungal activity. In this study, two series of melatonin derivatives containing a semicarbazide or a thiosemicarbazide group were designed and synthesized. The antifungal screening results indicated that compound III-9 exhibited a broad antifungal spectrum against six phytopathogenic fungi at 50 µg/mL, with over 60% growth inhibition, and this is highlighted by its inhibition rates of 80.8% and 87.2% against Botrytis cinerea and Rhioctorzia solani, respectively, which was superior to the commercial fungicide Osthole. It also showed moderate antifungal activity in vivo against Cucumber botrytis cinerea, Sclerotinia sclerotiorum, and Phytophthora capsica at 200 µg/mL. And the scanning electron microscope (SEM), molecular docking, and enzymatic activity results provided insights into the potential mechanisms underlying the antifungal activity of these derivatives, which might target succinate dehydrogenase (SDH). Study of structure-activity relationships (SAR) and pesticide-likeness prediction offered valuable guidance for the future structural optimization of melatonin derivatives.