In Shark Bay, Western Australia, male bottlenose dolphins form a complex nested alliance hierarchy. At the first level, pairs or trios of unrelated males cooperate to herd individual females. Multiple first-order alliances cooperate in teams (second-order alliances) in the pursuit and defence of females, and multiple teams also work together (third-order alliances). Yet it remains unknown how dolphins classify these nested alliance relationships. We use 30 years of behavioural data combined with 40 contemporary sound playback experiments to 14 allied males, recording responses with drone-mounted video and a hydrophone array. We show that males form a first-person social concept of cooperative team membership at the second-order alliance level, independently of first-order alliance history and current relationship strength across all three alliance levels. Such associative concepts develop through experience and likely played an important role in the cooperative behaviour of early humans. These results provide evidence that cooperation-based concepts are not unique to humans, occurring in other animal societies with extensive cooperation between non-kin.