Staphylococcus aureus is a widely distributed and highly pathogenic zoonotic bacterium. Sortase A represents a crucial target for the research and development of novel antibacterial drugs. This study aims to establish quantitative structure-activity relationship models based on the chemical structures of a class of benzofuranene cyanide derivatives. The models will be used to screen new antibacterial agents and predict the properties of these molecules. The compounds were randomly divided into a training set and a test set. A large number of descriptors were calculated using the software, and then the appropriate descriptors were selected to build the models through the heuristic method and the gene expression programming algorithm. In the heuristic method, the determination coefficient, determination coefficient of cross-validation, F-test, and mean squared error values were 0.530, 0.395, 9.006, and 0.047, respectively. In the gene expression programming algorithm, the determination coefficient and the mean squared error values in the training set were 0.937 and 0.008, respectively, while in the test set, they were 0.849 and 0.035. The results showed that the minimum bond order of a C atom and the relative number of benzene rings had a significant positive contribution to the activity of compounds. In this study, two quantitative structure-activity relationship models were successfully established to predict the inhibitory activity of a series of compounds targeting Staphylococcus aureus Sortase A, providing insights for further development of novel anti-Staphylococcus aureus drugs.