Objective To investigate the application effect of ultrasound⁃guided caudal block after esketamine pretreatment in percutaneous endoscopic lumbar discectomy (PELD). Methods A total of 96 patients with lumbar disc herniation undergoing PELD were randomly divided into observation group or control group, with 48 cases in each group. Both groups received general anesthesia combined with ultrasound⁃guided caudal block, while the observation group received esketamine pretreatment before ultrasound⁃guided caudal block. Heart rate and mean arterial pressure (MAP) were recorded before anesthesia induction (T0), 5 minutes after anesthesia induction (T1), 30 minutes after skin incision (T2), and at the end of incision closure (T3). The dosage of remifentanil, recovery time, and post⁃recovery agitation were compared between the two groups. Inflammatory factor levels in terms of C⁃reactive protein (CRP), interleukin 6 (IL⁃6), tumor necrosis factor α (TNF⁃α), stress indicators (adrenocorticotropic hormone [ACTH], cortisol, and lactic acid) before surgery and 24 hours after surgery, as well as cognitive function before surgery, 24 and 48 hours after surgery were compared between the two groups. Adverse reactions were recorded in both groups. Results MAP and heart rate at T1, T2, and T3 in both groups were lower than those at T0, and MAP and heart rate in the observation group were higher than those in the control group (P<0.05). The remifentanil dosage, recovery time, incidence rate of post⁃recovery agitation, and total incidence rate of adverse reactions in the observation group were less, shorter or lower than those in the control group (P<0.05). Postoperatively, levels of serum CRP, IL⁃6, TNF⁃α, and ACTH, cortisol, lactic acid in both groups were higher than preoperative indices, but the above indicators in the observation group were lower than those in the control group (P<0.05). The Mini⁃Mental State Examination (MMSE) scores at 24 and 48 hours after surgery in both groups were lower than preoperative scores, and the MMSE score in the observation group at 24 and 48 hours after surgery was higher than those in the control group (P<0.05). Conclusion The application of esketamine pretreatment combined with ultrasound⁃guided caudal block in PELD can reduce postoperative inflammatory responses and stress indicators, while improving hemodynamic stability and postoperative cognitive function, with a good safety.