Male animals may adjust their resource allocations for reproduction and other fitness functions in response to cues from rivals. For instance, adult males increase their investment in sperm for a higher paternity share when they perceive sperm competition risk in their surroundings. In nature, both juveniles and adults may coexist spatially and temporally. Yet, it is not clear how juvenile males of different ages respond to cues from adult rivals and fine‐tune their lifetime investment in sperm production and ejaculation in any insect. Here we used the Mediterranean flour moth, Ephestia kuehniella, which produces both fertile eupyrene and infertile apyrene sperm, to explore this question. We demonstrate that the late, but not early, instar larvae are sensitive to adult male cues. As a response, they produce more sperm before emergence and their resultant adults have shorter mating latency and ejaculate more sperm in the first few matings. When the juvenile stage produces more eupyrenes, the adult stops making these sperm, but regardless of the number of apyrenes produced during the juvenile stage, the adult continues to make them. These findings suggest that the number of spermatogonia for eupyrenes may be limited and that for apyrenes may be flexible. Our results show that the insect does not trade off survival, mating frequency, body size, or testis size for sperm production in response to adult males during the larval stage. Knowledge created in the present study offers insight into the stage‐dependent sensitivity of juvenile males to cues from adult rivals and subsequent lifetime resource allocations.