Since December 2019, global batch recalls of metformin pharmaceutical products have highlighted an urgent need to control N-nitrosodimethylamine (NDMA) contamination to demonstrate patient safety and maintain supply of this essential medicine. Due to their formulation, the metformin extended-release products present difficult analytical challenges for conventional sample preparation procedures, such as artefactual (in-situ) NDMA formation, gelling, and precipitation. To overcome these challenges, a new version of dispersive liquid-liquid microextraction (DLLME) termed dispersant-first DLLME (DF-DLLME) was developed and optimized for the analysis of NDMA in metformin extended-release products using a detailed Design of Experiments (DoE) to optimize sample preparation. Gas chromatography-high resolution accurate mass-mass spectrometry (GC-HRAM-MS) combined with automated DF-DLLME were successfully applied to monitor the NDMA levels of two different metformin extended-release AstraZeneca products to ultra-trace levels (parts per billion). The additional benefits associated with DF-DLLME, which include automation, time/costs saving, and greener sample preparation, make this novel technique easier to transfer from a development to Quality Control (QC) environment. In addition, this also offers an attractive candidate for the wider platform analysis of N-nitrosamines in pharmaceutical drug products.