The Cobblers had a man sent off for the fourth successive away game when Ishmel Demontagnac ludicrously kicked out at Alli in the first half and the Dons took full advantage.
Milton Keynes controlled the first half and Bamford twice went close with headers, first glancing Jason Banton's cross against a post and then nodding debutant Danny Green's cross just wide.
Yet Northampton were holding their own defensively until Demontagnac was given his marching orders in the 33rd minute for wildly hacking down Alli after being robbed of possession by the Dons starlet.
The home side made their extra man count after the break and Bamford broke the deadlock seven minutes after the restart, volleying in Banton's deflected cross from close range for his fourth goal of the season.
And Alli doubled the hosts' lead six minutes later when he rammed the ball high into the net from Banton's cutback to open his account for the season.