Thermal polymerization (TP) and electropolymerization (EP) are the two methods used in this study to explore the molecular imprinting process. To detect the antiviral medication lopinavir (LPV), an inhibitor of enzyme HIV-1 protease that is co-formulated with ritonavir (RTV) to extend its half-life in the body, with greater precision, these methods were merged with an electrochemical sensor. The sensors were created on glassy carbon electrodes (GCE) based on molecularly imprinted polymers (MIP) using TP with methacrylic acid (MAA) functional monomer and EP with p-aminobenzoic acid (PABA) functional monomer. Fourier transform infrared spectroscopy (FT-IR), scanning electron microscopy (SEM), and electrochemical methods were utilized to examine the technical features of the suggested sensors. For both approaches, the necessary optimization investigations were carried out. Different LPV concentrations, ranging from 1.0 pM to 17.5 pM in drug solution and commercial human serum samples, were used to validate the analytical efficiency of the two sensors and compare their electroanalytical behaviour. For TP-LPV@MIP/GCE and EP-LPV@MIP/GCE, the corresponding limit of detection (LOD) was 2.68 × 10-13 M (0.169 pg mL-1) and 1.79 × 10-13 M (0.113 pg mL-1) in standard solutions, and 2.87 × 10-13 M (0.180 pg mL-1) and 2.91 × 10-13 M (0.183 pg mL-1) in serum samples. For the measurement of LPV in tablet form and serum samples, the proposed TP-LPV@MIP/GCE and EP-LPV@MIP/GCE sensors provide good recovery, demonstrating 99.85-101.16 % and 100.36-100.97 % recovery, respectively. The imprinting factor was utilized to demonstrate the selectivity of the suggested sensors by utilizing several anti-viral drugs that are structurally comparable to LPV. Additionally, the constructed sensors were examined for the potential impacts of interferences and the stability during the storage.