Convolutional Neural Networks (CNNs) have been successfully applied in the medical diagnosis of different types of diseases . However, selecting the architecture and the best set of hyperparameters among the possible combinations can be a significant challenge . The purpose of this work is to investigate the use of the Hyperband optimization algorithm in the process of optimizing a CNN applied to the diagnosis of SARS-Cov2 disease (COVID-19). The test was performed with the Optuna framework, and the optimization process aimed to optimize four hyperparameters: (1) backbone architecture, (2) the number of inception modules, (3) the number of neurons in the fully connected layers, and (4) the learning rate . CNNs were trained on 2175 computed tomography (CT) images . The CNN that was proposed by the optimization process was a VGG16 with five inception modules , 128 neurons in the two fully connected layers, and a learning rate of 0.0027 . The proposed method achieved a sensitivity, precision, and accuracy of 97% , 82%, and 88%, outperforming the sensitivity of the Real-Time Polymerase Chain Reaction (RT-PCR) tests (53–88 %) and the accuracy of the diagnosis performed by human experts (72 %).