Sociability is crucial for survival, whereas social avoidance is a feature of disorders such as Rett syndrome, which is caused by loss-of-function mutations in MECP2. To understand how a preference for social interactions is encoded, we used in vivo calcium imaging to compare medial prefrontal cortex (mPFC) activity in female wild-type and Mecp2-heterozygous mice during three-chamber tests. We found that mPFC pyramidal neurons in Mecp2-deficient mice are hypo-responsive to both social and nonsocial stimuli. Hypothesizing that this limited dynamic range restricts the circuit’s ability to disambiguate coactivity patterns for different stimuli, we suppressed the mPFC in wild-type mice and found that this eliminated both pattern decorrelation and social preference. Conversely, stimulating the mPFC in MeCP2-deficient mice restored social preference, but only if it was sufficient to restore pattern decorrelation. A loss of social preference could thus indicate impaired pattern decorrelation rather than true social avoidance.