Life-history theory maintains that organisms allocate limited resources to different traits to maximize fitness. Learning ability and memory are costly and known to trade-off with longevity in invertebrates. However, since the relationship between longevity and fitness often differs between the sexes, it is likely that sexes will differentially resolve the trade-off between learning and longevity. We used an established associative learning paradigm in the dioecious nematode Caenorhabditis remanei, which is sexually dimorphic for lifespan, to study age-related learning ability in males and females. In particular, we tested the hypothesis that females (the shorter-lived sex) show higher learning ability than males early in life but senesce faster. Indeed, young females outperformed young males in learning a novel association between an odour (butanone) and food (bacteria). However, while learning ability and offspring production declined rapidly with age in females, males maintained high levels of these traits until mid-age. These results not only demonstrate sexual dimorphism in age-related learning ability but also suggest that it conforms to predictions derived from the life-history theory.