Pediatricians use sevoflurane due to its fast action and short recovery time. However, studies have shown that repeated exposure to anesthesia can affect learning and memory. Melatonin, an indole-type neuroendocrine hormone, has significant anti-inflammatory, and neuroprotective properties. Melatonin’s impact on cognitive behavior in sevoflurane-anesthetized males and females of the Wistar rats during preadolescence was examined in this research. The cognitive function was evaluated by shuttle box and morris water maze tests, while interleukin-10, Catalase (CAT), Malondialdehyde (MDA), and Tumor Necrosis Factor-α (TNF-α) were evaluated using ELISA kits. The expression levels of the apoptosis-linked proteins, Bax, Bcl-2, and caspase-3, were determined using the western blotting technique. The learning and memory latencies of the rats were more significant in the sevoflurane groups than in the control group; however, the latencies were significantly shorter in the sevoflurane and melatonin groups than in the control group. The levels of MDA, TNF-α, Bax, and caspase-3 were significantly higher in the sevoflurane groups than in the control group. We also found that the levels of CAT and Bcl-2 were significantly reduced in the sevoflurane groups compared to the control group. Increasing levels of CAT, Bcl-2, and decreasing levels of MDA, TNF-α, Bax, and caspase-3 in response to melatonin indicate a possible contribution to the recovery from the sevoflurane impairment. Melatonin shows neuroprotective effects in male and female rats with sevoflurane-induced cognitive impairment. This suggests melatonin could be a valuable treatment for learning and memory deficits resulting from repeated exposure to sevoflurane, possibly by controlling apoptosis, oxidative stress, and inflammation.