Detecting cyberattacks is critical for maintaining the security and integrity of industrial control systems (ICSs). This study introduces a machine learning approach for identifying cyberattacks on the Secure Water Treatment (SWaT) plant testbed. The dataset, sourced from the Singapore University of Technology and Design, includes data from 51 sensors and actuators. The research employs a Long Short-Term Memory (LSTM) network alongside traditional machine learning algorithms like Random Forest (R.F.), Support Vector Machine (SVM), and K-Nearest Neighbour (KNN) to classify cyberattacks. The LSTM model outperformed the other methods, achieving a test accuracy of 98.02% (cyberattack: 97.80%, non-attack: 98.30%). Given the imbalanced nature of the dataset, additional metrics such as precision, recall, and F1 score were evaluated, further confirming the LSTM model’s robustness compared to traditional algorithms. This research demonstrates the LSTM network’s effectiveness in enhancing cybersecurity for ICSs and underscores the need for proactive strategies in detecting and mitigating cyber threats.