Two first-half-strikes from Alli had the visitors in control before Alan Sheehan gave the home side a glimmer of hope when he pulled one back with 20 minutes remaining.
But Alli was not to have his night spoiled and wrapped up his hat-trick – and all three points – in the dying moments at Meadow Lane.
Karl Robinson’s side could have been two goals down in the opening minute after Callum McGregor saw a shot saved and Hayden Mullins hit the bar.
But Alli made the most of some erratic Magpies defending to give the visitors the lead in the third minute with a calm finish.
The visitors scored a second 10 minutes into the second half after Mullins’ backpass was intercepted by Izale McLeod who raced through on goal to square for Alli to grab his second.
Bottom-side County kept plugging away and were rewarded when Sheehan converted from the spot after Jordan Spence had handled.
But Alli ended their comeback when he fired home in the last minute.