The integration of advanced control systems in prostheses necessitates the accurate identification of human locomotion activities, a task that can significantly benefit from EEG-based measurements combined with machine learning techniques. The main contribution of this study is the development of a novel framework for the recognition and classification of locomotion activities using electroencephalography (EEG) data by comparing the performance of different machine learning algorithms. Data of the lower limb movements during level ground walking as well as going up stairs, down stairs, up ramps, and down ramps were collected from 10 healthy volunteers. Time- and frequency-domain features were extracted by applying independent component analysis (ICA). Successively, they were used to train and test random forest and k-nearest neighbors (kNN) algorithms. For the classification, random forest revealed itself as the best-performing one, achieving an overall accuracy up to 92%. The findings of this study contribute to the field of assistive robotics by confirming that EEG-based measurements, when combined with appropriate machine learning models, can serve as robust inputs for prosthesis control systems.