Epilepsy is a neurological disorder characterized by recurrent seizures, and anticonvulsant medications are the mainstay of treatment. However, individual responses vary substantially. Identifying the underlying genetic factors that influence anticonvulsant responses remains a challenge. This study investigated the relationship between anticonvulsants and related genes using artificial intelligence (AI) modeling. We used a comprehensive dataset of anticonvulsant medications and genetic profiles. The XGBoost model and ontology method were developed to elucidate the complex interplay between these factors and predict individual responses to anticonvulsant treatment. The interpretability of the predictive model and ontology analysis facilitated the identification of specific genes and their interactions that contribute to anticonvulsant efficacy. The model performance was evaluated using metrics like area under the curve (AUC), accuracy, sensitivity, and specificity. AI modeling was used to analyze the main features of gene interactions for enzymes, ion channels, cytochromes, and kinases in order of importance. Serine/threonine kinase and drug resistance showed a strong correlation coefficient of 0.93. Three topics were identified on the principal component plane by grouping salient genes, such as SCN and CYP, with each relevant gene predicted by each topic (anticonvulsant). Based on modeling, the AUCmax, accuracy, sensitivity, and specificity were 0.84, 0.89, 0.77, and 0.97, respectively. The findings of this study could revolutionize personalized medicine approaches for epilepsy by providing a deeper understanding of the genetic basis of anticonvulsant responses and facilitating the development of targeted treatment strategies.