Cooperation is fundamental for survival and a functioning society. With substantial individual variability in cooperativeness, we must learn whom to cooperate with, and often make these decisions on behalf of others. Understanding how people learn about the cooperativeness of others, and the neurocomputational mechanisms supporting this learning, is therefore essential. During functional magnetic resonance imaging scanning, participants completed a novel cooperation-partner-choice task where they learned to choose between cooperative and uncooperative partners through trial-and-error both for themselves and vicariously for another person. Interestingly, when choosing for themselves, participants made faster and more exploitative choices than when choosing for another person. Activity in the ventral striatum preferentially responded to prediction errors (PEs) during self-learning, whereas activity in the perigenual anterior cingulate cortex (ACC) signaled both personal and vicarious PEs. Multivariate pattern analyses showed distinct coding of personal and vicarious choice-making and outcome processing in the temporoparietal junction (TPJ), dorsal ACC, and striatum. Moreover, in right TPJ the activity pattern that differentiated self and other outcomes was associated with individual differences in exploitation tendency. We reveal neurocomputational mechanisms supporting cooperative learning and show that this learning is reflected in trial-by-trial univariate signals and multivariate patterns that can distinguish personal and vicarious choices.