The accurate and rapid diagnosis of COVID-19 has been a critical challenge worldwide. Several approaches have been proposed to address this issue, including clinical tests, imaging techniques like chest X-rays and CT scans, and the widely used RT-PCR test. Recently, deep convolutional neural networks (CNNs) have been shown to be effective in detecting COVID-19 in CT scan images. In this study, we investigated the efficacy of ResNet, a state-of-the-art deep CNN, along with attention mechanisms to detect COVID-19 in CT scan images. Furthermore, we introduced a novel CNN, named AdjCNet, which focuses on the grayscale variations among adjacent areas within the image. Our combination of ResNet, Convolutional Block Attention Module (CBAM), and AdjCNet achieved an outstanding classification accuracy of 99.23% for CT images in identifying COVID-19, Normal, or Community Acquired Pneumonia (CAP). Specifically, our proposed method achieved a precision of 100% for identifying CAP images and a precision exceeding 99% for the other two classes. In addition, we performed a four-folds cross-validation to evaluate the performance of our proposed model for COVID-19 detection using CT-scan images. The results of the four-folds cross-validation demonstrated that our proposed model achieved a mean accuracy and precision of 98.98% and 99.01%, respectively, over the four folds. The final results clearly demonstrate the superiority of our proposed method over the state-of-the-art methods on this dataset. Our findings suggest that our proposed method could serve as an effective and efficient tool for COVID-19 diagnosis, and further studies can explore its application in clinical settings.