The intrusion recognition along the railway is still a challenging problem in railway safety monitoring based on the phase-sensitive optical-time-domain reflectometer (Φ-OTDR), because the access scope is expanding between operation and external environment, and there are many unknown vibration sources interfering at different fiber locations, which are unpredictable and changing from time to time. To reduce the nuisance alarm rate (NAR) of the system, a novel data driven identification method based on XGBoost model is proposed in this article. We have completed a real implementation from the sensor to the final output, including data collection, signal processing (framing, denoising), feature extraction, model designing and evaluation, which is a successful case of distributed optical fiber sensing in the railway sector. The results indicate that the average recognition accuracy of this article is as high as 98.5% in frequently external intrusion events. All the related performance metrics of confusion matrix are better than other popular methods, such as random forest, support vector machine and multilayer perceptron.