A sensitive electrochemical DNA biosensor has been developed for the detection of Buprenorphine (Bu), a narcotic pain reliever. To achieve this, double-stranded DNA (ds-DNA) was immobilized on a pencil graphite electrode that was modified with gold nanoparticles (Au NPs/PGE). The gold nanoparticles enhanced the performance of the DNA biosensor. The constructed ds-DNA/Au NPs/ PGE exhibited a linear detection range spanning from 0.05 to 100 μM with an impressive detection limit of 20 nM for Bu detection. Additionally, the DNA biosensor demonstrated good response in real samples evaluations. Finally, the interaction between carbon and gold atoms with DNA was confirmed through molecular dynamics simulation, while the interaction between DNA and the Bu drug was confirmed through molecular docking method. In conclusion, the electrochemical DNA biosensor presented in this study demonstrates exceptional sensitivity and reliability in the detection of buprenorphine. The incorporation of gold nanoparticles, as well as the use of molecular dynamics simulations and docking methods, contributes to a comprehensive understanding of the interactions involved in this detection process.