Background:DBS entails the insertion of an electrode into the patient brain, enabling Subthalamic nucleus (STN) stimulation. Accurate delineation of STN borders is a critical but time-consuming task, traditionally reliant on the neurosurgeon experience in deciphering the intricacies of microelectrode recording (MER). While clinical outcomes of MER have been satisfactory, they involve certain risks to patient safety. Recently, there has been a growing interest in exploring the potential of local field potentials (LFP) due to their correlation with the STN motor territory. Method:A novel STN detection system, integrating LFP and wavelet packet transform (WPT) with stacking ensemble learning, is developed. Initial steps involve the inclusion of soft thresholding to increase robustness to LFP variability. Subsequently, non-linear WPT features are extracted. Finally, a unique ensemble model, comprising a dual-layer structure, is developed for STN localization. We harnessed the capabilities of support vector machine, Decision tree and k-Nearest Neighbor in conjunction with long short-term memory (LSTM) network. LSTM is pivotal for assigning adequate weights to every base model. Results:Results reveal that the proposed model achieved a remarkable accuracy and F1-score of 89.49% and 91.63%. Comparison with existing methods:Ensemble model demonstrated superior performance when compared to standalone base models and existing meta techniques. Conclusion:This framework is envisioned to enhance the efficiency of DBS surgery and reduce the reliance on clinician experience for precise STN detection. This achievement is strategically significant to serve as an invaluable tool for refining the electrode trajectory, potentially replacing the current methodology based on MER.