The British Heart Foundation, which is funding the work, says detecting people at risk of diabetes could ultimately save lives.
Having uncontrolled type 2 diabetes can lead to heart attacks and strokes, for example.
Maintaing a healthy weight and eating a healthy diet and exercising can help protect against complications.
Professor Bryan Williams, Chief Scientific and Medical Officer at the British Heart Foundation, said: “This exciting research uses powerful artificial intelligence to analyse ECGs, revealing how AI can spot things that cannot usually be observed in routinely collected health data. This kind of insight could be a gamechanger in predicting future risk of developing type 2 diabetes, years before the condition begins.
“Type 2 diabetes is a rapidly growing health challenge that increases the risk of developing heart disease, however with the right support it is possible for people to reduce their risk of developing the condition. We look forward to seeing how this technology could be incorporated into clinical practice.”
Dr Faye Riley from Diabetes UK said: “Type 2 diabetes often goes undiagnosed, sometimes for many years. With 1.2 million people in England alone unaware they’re living with the condition and millions more at high risk of developing it, identifying those at risk early on is crucial.
“AI-powered screening methods offer a promising new way to spot those likely to develop type 2 diabetes years in advance, allowing them to access the right support and prevent serious complications, such as heart failure and sight loss.”