There is increasing evidence that hyperenergetic diets have an impact on memory in rodents. However, it is largely unknown how diets, such as a cafeteria diet (CD), that mimic a Western-type diet act on learning and memory, in particular when fed during early stages of development. Here, we fed lactating dams a CD and exposed both male and female offspring to a novel object discrimination (NOD) task, a two-trial test of recognition memory in which rats exposed to two identical objects during a training/familiarisation trial can discriminate a novel from a familiar object during the subsequent choice trial. The choice trial was performed following inter-trial interval (ITI) delays of up to 4 h. Maternal diet did not have an impact on exploration of the objects by either sex during the familiarisation trial. Control males discriminated the novel from the familiar object, indicating intact memory with an ITI of 1 h, but not 2 or 4 h. The CD delayed this natural forgetting in male rats such that discrimination was also evident after a 2 h ITI. In contrast, control females exhibited discrimination following both 1 and 2 h ITI, but the CD impaired performance. In summary, the present study shows that maternal exposure to the CD programmes NOD in the adult. In better-performing females, dietary programming interferes with NOD, whereas NOD was improved in males after lactational CD feeding.