The 19-year-old poked home from six yards in the 82nd minute after Barnet keeper Ran Kadoch had failed to hold a Lee Bell corner.
It was only Macclesfield's seventh home win of the season and added a silver lining to an otherwise disappointing campaign.
Macclesfield took the lead in the second minute when centre-back Nat Brown bagged his sixth goal of the season with a towering head back across goal to convert a Bell free-kick.
Barnet should have equalised in the 12th minute, but their livewire striker Adam Birchall only got the faintest of touches to a free header from six yards out.
Brave Jordan Hadfield nearly added a second for the Silkmen on the half hour, but in heading inches past the far post, he picked up a concussion to be substituted ten minutes later.
Barnet equalised on 54 minutes when Neal Bishop crossed for Albert Adomah to poke home from close range.
They might have taken the lead on 67 minutes when Birchall hooked a 25-yard drive off the crossbar, then two minutes later they were only denied by a superb point-blank save from Jon Brain as Michael Leary connected with a powerful eight-yard header.
Macc striker Gareth Evans nearly caught Barnet napping in the 78th minute with a shot on the turn from a narrow angle that thumped the post from 15 yards.
Dennis then proved to be the Menace with his winning goal on 82 minutes.
Barnet failed to produce an outright chance in the closing stages as the home side's defence professionally closed down the game.