The integration of machine learning (ML) into medical diagnostics has significantly advanced endoscopic examinations for gastrointestinal diseases. By leveraging extensive datasets and sophisticated algorithms, ML technologies enhance diagnostic precision, detect subtle abnormalities, classify diverse pathologies and predict disease progression. However, their widespread adoption is hindered by the inherent heterogeneity of gastrointestinal diseases, technical limitations, limited generalisability across different populations and ethical challenges related to patient privacy, data security and algorithmic bias. This review provides a comprehensive structural analysis of ML approaches in endoscopy, starting with an overview of the classical endoscopic methodology that relies on direct visualisation of the gastrointestinal tract for diagnosis and therapeutic interventions. Then, current ML applications that hold promise for reducing physician-dependent variability, improving diagnostic accuracy and streamlining procedural workflows were explored. Despite these advances, the effectiveness of ML models often remains constrained by the quality and diversity of training data, which can undermine both reliability and generalisability. Ethical considerations – such as safeguarding patient information, upholding data security and mitigating biases embedded in algorithms – are integral to responsibly deploying ML in clinical settings. By examining these technical and ethical barriers, this work contributes to the evolving discourse on integrating advanced ML techniques into gastroenterology. Ultimately, our goal is to pave the way for more effective and reliable ML-driven endoscopic practices that will enhance disease detection, optimise patient care and benefit healthcare providers worldwide. © Author(s) (or their employer(s)) 2025. Re-use permitted under CC BY-NC. No commercial re-use. See rights and permissions. Published by BMJ Group.