How do people consider other minds during cooperation versus competition? Some accounts predict that theory of mind (ToM) is recruited more for cooperation versus competition or competition versus cooperation, whereas other accounts predict similar recruitment across these two contexts. The present fMRI study examined activity in brain regions for ToM (bilateral temporoparietal junction, precuneus, dorsomedial prefrontal cortex) across cooperative and competitive interactions with the same individual within the same paradigm. Although univariate analyses revealed that ToM regions overall were recruited similarly across interaction contexts, multivariate pattern analyses revealed that these regions nevertheless encoded information separating cooperation from competition. Specifically, ToM regions encoded differences between cooperation and competition when people believed the outcome was determined by their and their partner's choices but not when the computer determined the outcome. We propose that, when people are motivated to consider others' mental states, ToM regions encode different aspects of mental states during cooperation versus competition. Given the role of these regions for ToM, these findings reveal distinct patterns of social cognition for distinct motivational contexts.