In this study, 2‐mercapto‐3‐phenyl‐2,3‐dihydro‐1H‐quinazolin‐4‐one (1), which exists as a thiol and thione tautomer, was treated with acetylacetone to give the target compound, namely, 1‐methyl‐5‐phenyl‐5H‐pyrido[1,2‐a]quinazoline‐3,6‐dione (2). The spectroscopic data, including UV/Vis, IR, 1H NMR, 13C NMR, and mass data, of this compound were recorded. The molecular structures of the starting material (1) and the product (2) were optimized by using density functional theory (DFT) by employing the B3LYP exchange correlation with the 6‐311G (d, p) and 6‐31G++ (d, p) basis sets. The electronic spectra were determined based on time‐dependent DFT calculations in three different solvents (i.e., chloroform, ethanol, and acetonitrile) starting from the same solvated run of the optimized geometry with the same two basis sets. The solvent effects were considered based on the polarizable continuum model (PCM), and the energetic behavior of the compounds and the total static dipole moment (μ) in different solvents were examined in the two basis sets; the results showed that the total energy of the compounds decreased upon increasing the polarity of the solvent. Time‐dependent DFT calculations were performed to analyze the electronic transitions for various excited states that reproduced the experimental band observed in the UV/Vis spectrum. A study on the electronic properties, such as the HOMO and LUMO energies, was performed by the time‐independent DFT approach. Using the gauge‐independent atomic orbital method (GIAO), the 1H NMR chemical shifts were calculated and correlated with the experimental ones. The computed results showed that the introduction of different dielectric media had a slight effect on the stability and reactivity of the title compound as well as on the Milliken atomic charges and the molecular geometry. Besides, the molecular electrostatic potential of target product 2 was evaluated in different solvents.