Caffeine is a psychostimulant substance that is mostly used to prevent fatigue, increase alertness, and ameliorate sleep loss situations. In this study, we aimed to investigate the effect of chronic caffeine consumption on learning and memory functions and related genes in rapid eye movement (REM) sleep‐deprived rats. During the neonatal period (postnatal day [PND] 28) Wistar albino male rats (n = 32) were randomly assigned into four groups: Control (C), caffeine application (Cf), acute REM sleep‐deprivation (RD), and caffeine application + acute RD (Cf + RD). The 48 h of RD was executed when caffeine administration was completed. The learning and memory performance was evaluated by the Morris water maze test (MWMT). Following this, the rats were decapitated to isolate hippocampus tissues. In MWMT, time spent in the targeted quadrant decreased significantly in the RD group compared with the C and Cf + RD group. NR2A expression level increased in the RD group compared with C, Cf, and Cf + RD groups (p < 0.05). NR2B expression level increased in RD and Cf + RD groups compared with C and Cf groups (p < 0.05). BDNF and c‐Fos expression levels did not differ significantly between the groups. RD impaired hippocampal spatial memory performance in the MWMT test. Our results indicated that chronic caffeine consumption has a therapeutic effect on spatial memory deterioration impairment caused by RD. Furthermore, it seems that the effect of caffeine RD on the hippocampus may be mediated by NR2A.