Cancer and its surgical treatment are among the most important triggering events for persistent pain, but additional factors need to be present for the clinical manifestation, such as variants in pain-relevant genes. In a cohort of 140 women undergoing breast cancer surgery, assigned based on a 3-year follow-up to either a persistent or nonpersistent pain phenotype, next-generation sequencing was performed for 77 genes selected for known functional involvement in persistent pain. Applying machine-learning and item categorization techniques, 21 variants in 13 different genes were found to be relevant to the assignment of a patient to either the persistent pain or the nonpersistent pain phenotype group. In descending order of importance for correct group assignment, the relevant genes comprised DRD1, FAAH, GCH1, GPR132, OPRM1, DRD3, RELN, GABRA5, NF1, COMT, TRPA1, ABHD6, and DRD4, of which one in the DRD4 gene was a novel discovery. Particularly relevant variants were found in the DRD1 and GPR132 genes, or in a cis-eCTL position of the OPRM1 gene. Supervised machine-learning-based classifiers, trained with 2/3 of the data, identified the correct pain phenotype group in the remaining 1/3 of the patients at accuracies and areas under the receiver operator characteristic curves of 65% to 72%. When using conservative classical statistical approaches, none of the variants passed α-corrected testing. The present data analysis approach, using machine learning and training artificial intelligences, provided biologically plausible results and outperformed classical approaches to genotype-phenotype association.