Imatinib mesylate, an anticancer drug, is prescribed to treat gastrointestinal stromal tumors and chronic myelogenous leukemia. A hybrid nanocomposite of N,S-doped carbon dots/carbon nanotube-poly(amidoamine) dendrimer (N,S-CDs/CNTD) was successfully synthesized and used as a significant modifier to design a new and highly selective electrochemical sensor for the determination of imatinib mesylate. A rigorous study with electrochemical techniques, such as cyclic voltammetry and differential pulse voltammetry, was performed to elucidate the electrocatalytic properties of the as-prepared nanocomposite and the preparation procedure of the modified glassy carbon electrode (GCE). A higher oxidation peak current was generated for the imatinib mesylate on a N,S-CDs/CNTD/GCE surface compared to the GCE and CNTD/GCE. The N,S-CDs/CNTD/GCE showed a linear relationship between the concentration and oxidation peak current of the imatinib mesylate in 0.01–100 μM, with a detection limit of 3 nM. Finally, the imatinib mesylate’s quantification in blood-serum samples was successfully performed. The N,S-CDs/CNTD/GCE’s reproducibility and stability were indeed excellent.