Abstract Associative learning is crucial for adapting to environmental changes. The encoding of associative learning involves the dorso-medial prefrontal cortex (dmPFC), and is underpinned by interactions within the resident neuronal population. However, the nature of this population coding is poorly understood. Here we developed a pipeline for computational dissection and longitudinal two-photon imaging of neural population activities in the mouse dmPFC during fear-conditioning procedures, enabling us to detect learning-dependent changes in the dmPFC topology. Through regularized regression methods and graphical modeling, we found fear conditioning organized neuronal ensembles encoding conditioned responses (CR), with enhancing their coactivity, functional connectivity, and association with conditioned stimuli (CS). This suggests that fear conditioning drives dmPFC reorganization to generate novel associative circuits for CS-to-CR transformation. Importantly, neurons strongly responding to unconditioned stimuli (US) during conditioning anterogradely became a hub of the CR ensemble. Altogether, we demonstrate learning-dependent dynamic modulation of population coding structured on an activity-dependent hub-network formation within the dmPFC. Teaser Optical and computational dissection uncovered how prefrontal cortical networks are rewired to encode new associative memory Significance statement Animals learn to adapt to changing environments. Associative learning is one of the simplest types of learning that has been intensively studied over the past century. Recent development in molecular, genetic, and optogenetic methods has enabled the identification of a neural population encoding the associative memory in the brain. However, it remains unclear how information is stored and processed by the neural population to encode and retrieve the associative memory. To investigate the nature of this population coding, we developed an optical and computational dissection method, demonstrating how associative learning drives reorganization of the neural network in the dorso-medial prefrontal cortex and generates novel circuits for associative memory and signal transformation.