Selective dorsal rhizotomy (SDR) can reduce the spasticity in patients with spastic cerebral palsy (SCP) and thus improve the motor function in these patients, but different levels of improvement in motor function were observed among patients after SDR. The aim of the present study was to subgroup patients and to predict the possible outcome of SDR based on the pre-operational parameters. A hundred and thirty-five pediatric patients diagnosed with SCP who underwent SDR from January 2015 to January 2021 were retrospectively reviewed. Spasticity of lower limbs, the number of target muscles, motor functions, and other clinical parameters were used as input variables for unsupervised machine learning to cluster all included patients. The postoperative motor function change is used to assess the clinical significance of clustering. After the SDR procedure, the spasticity of muscles in all patients was reduced significantly, and the motor function was promoted significantly at the follow-up duration. All patients were categorized into three subgroups by both hierarchical and K-means clustering methods. The three subgroups showed significantly different clinical characteristics except for the age at surgery, and the post-operational motor function change at the last follow-up in these three clusters was different. Three subgroups clustered by two methods could be identified as “best responders”, “good responders” and “moderate responders” based on the increasement of motor function after SDR. Clustering results achieved by hierarchical and K-means algorithms showed high consistency in subgrouping the whole group of patients. These results indicated that SDR could relieve the spasticity and promote the motor function of patients with SCP. Unsupervised machine learning methods can effectively and accurately cluster patients into different subgroups suffering from SCP based on pre-operative characteristics. Machine learning can be used for the determination of optimal responders for SDR surgery.