The ability to exert cognitive control is central to human brain function, facilitating goal-directed task performance. However, humans exhibit limitations in the duration over which they can exert cognitive control---a phenomenon referred to as cognitive fatigue. This study explores a computational rationale for cognitive fatigue in continual learning scenarios: cognitive fatigue serves to limit the extended performance of one task to avoid the forgetting of previously learned tasks. Our study employs a meta-learning framework, wherein cognitive control is optimally allocated to balance immediate task performance with forgetting of other tasks. We demonstrate that this model replicates common patterns of cognitive fatigue, such as performance degradation over time and sensitivity to reward. Furthermore, we discuss novel predictions, including variations in cognitive fatigue based on task representation overlap. This approach offers a novel perspective on the computational role of cognitive fatigue in neural systems.