Converging behavioral evidence suggests that people respond to experiences of social exclusion with both defensive and affiliative strategies, allowing them to avoid further distress while also encouraging re-establishment of positive social connections. However, there are unresolved questions regarding the cognitive mechanisms underlying people's responses to social exclusion. Here, we sought to gain insight into these behavioral tendencies by using functional magnetic resonance imaging (fMRI) to examine the impact of social exclusion on neural responses to visual scenes that varied on dimensions of sociality and emotional valence. Compared to socially included participants, socially excluded participants failed to recruit dorsomedial prefrontal cortex (dmPFC), a brain region involved in mentalizing, for negative social scenes. Moreover, following social exclusion, dmPFC demonstrated a linear effect of valence, with greater activity to positive social scenes compared to negative social scenes. These results suggest that, following social exclusion, people display a preference for mentalizing about positive social information and tend to avoid negative aspects of their social world.