Coincidental spike discharge amongst distributed groups of neurons is thought to provide an efficient mechanism for encoding percepts, actions and cognitive processes. Short timescale coactivity can indeed bind neurons with similar tuning, giving rise to robust representations congruent with those of the participating neurons. Alternatively, coactivity may also play a role in information processing through encoding variables not represented by individual neurons. While this type of emergent coactivity-based coding has been described for physically well-defined variables, including percepts and actions, its role in encoding abstract cognitive variables remains unknown. Coactivity-based representation could provide a flexible code in dynamic environments, where animals must regularly learn short-lived behavioural contingencies. Here, we tested this possibility by training mice to discriminate two new behavioural contingencies every day, while monitoring and manipulating neural ensembles in the hippocampal CA1. We found that, while the spiking of neurons within their place fields is organised into congruent coactivity patterns representing discrete locations during unsupervised exploration of the learning enclosure, additional neurons synchronised their activity into spatially-untuned patterns that discriminated opposing learning contingencies. This contingency discrimination was an emergent property of millisecond timescale coactivity rather than the tuning of individual neurons, and predicted trial-by-trial memory performance. Moreover, optogenetic suppression of plastic inputs from the upstream left CA3 region during learning selectively impaired the computation of contingency-discriminating, but not space-representing CA1 coactivity patterns. This manipulation, but not silencing the more stable right CA3 inputs, impaired memory of the contingency discrimination. Thus, the computation of an emergent, coactivity-based discrimination code necessitates plastic synapses and supports dynamic, two-contingency memory.