A molecularly imprinted polymer (MIP) was developed for the electrochemical determination of the antiviral drug sofosbuvir (SOF). The MIP was obtained by polymerization of p-aminothiophenol (p-ATP) on N,S co-doped graphene quantum dots (N,S@GQDs) in the presence of gold nanoparticles to form gold-sulfur covalent network. The presence of quantum dots improves the electron transfer rate, enhances surface activity and amplifies the signal. The nanocomposites were characterized by FTIR, TEM, EDX, and SEM. The electrochemical performance of the electrode was investigated by differential pulse voltammetry and cyclic voltammetry. The sensor uses hexacyanoferrate as the redox probe and is best operated at a potential of around 0.36V vs. Ag/AgCl. It has a linear response over the concentration range of 1-400nM SOF, with a detection limit of 0.36nM. Other features include high selectivity, good reproducibility and temporal stability. The sensor was applied to the determination of SOF in spiked human plasma. Graphical abstract Novel sofosbuvir imprinted p-ATP polymer was synthesized by the aid of gold nanoparticles on N,S co-doped graphene quantum dots as a good conductive support. The imprintedpolymer was used for detection of sofosbuvir in real samples by using the ferri/ferrocyanide redox probe.