Prefrontal cortical neurons play in important roles in performing rule-dependent tasks and working memory-based decision making. Motivated by experimental data, we develop an excitatory-inhibitory spiking recurrent neural network (SRNN) to perform a rule-dependent two-alternative forced choice (2AFC) task. We imposed several important biological constraints onto the SRNN, and adapted the spike frequency adaptation (SFA) and SuperSpike gradient methods to update the network parameters. These proposed strategies enabled us to train the SRNN efficiently and overcome the vanishing gradient problem during error back propagation through time. The trained SRNN produced rule-specific tuning in single-unit representations, showing rule-dependent population dynamics that strongly resemble experimentally observed data in rodent and monkey. Under varying test conditions, we further manipulated the parameters or configuration in computer simulation setups and investigated the impacts of rule-coding error, delay duration, weight connectivity and sparsity, and excitation/inhibition (E/I) balance on both task performance and neural representations. Overall, our modeling study provides a computational framework to understand neuronal representations at a fine timescale during working memory and cognitive control.Author SummaryWorking memory and decision making are fundamental cognitive functions of the brain, but the circuit mechanisms of these brain functions remain incompletely understood. Neuroscientists have trained animals (rodents or monkeys) to perform various cognitive tasks while simultaneously recording the neural activity from specific neural circuits. To complement the experimental investigations, computational modeling may provide an alternative way to examine the neural representations of neuronal assemblies during task behaviors. Here we develop and train a spiking recurrent neural network (SRNN) consisting of balanced excitatory and inhibitory neurons to perform the rule-dependent working memory tasks Our computer simulations produce qualitatively similar results as the experimental findings. Moreover, the imposed biological constraints on the trained network provide additional channel to investigate cell type-specific population responses, cortical connectivity and robustness. Our work provides a computational platform to investigate neural representations and dynamics of cortical circuits a fine timescale during complex cognitive tasks.