Mandzukic slid in at the far post to meet Juan Cuadrado's cross and send the ball through the legs of visiting goalkeeper Pierluigi Gollini, denying Atalanta a victory that would have left them on the brink of qualification for next season's Champions League.
What was billed as Allegri's farewell party, and also featured a final appearance at Allianz Stadium for the retiring Andrea Barzagli, failed to provide the home crowd with too many reasons to celebrate, their team failing to win for a fourth consecutive match.
They also ended the game down to 10 men after substitute Federico Bernardeschi was shown a straight red card late in the second half for a dangerous sliding challenge on Musa Barrow.
While a disappointing result in his home farewell will not tarnish Allegri's legacy, the way Juventus' form has dipped at the end of this campaign will make his departure easier to swallow for supporters after five trophy-laden years with him at the helm.
After the stadium rose in unison to say farewell to Barzagli prior to kick-off, Cristiano Ronaldo blazed over the crossbar with the goal at his mercy inside the first minute.
Wojciech Szczesny made a fine save from Remo Freuler's raking drive before Hans Hateboer hit the crossbar as Atalanta probed for an opener, Duvan Zapata also firing narrowly wide.
The goal the visitors deserved for their first-half endeavour finally arrived when Andrea Masiello's near-post flick towards Alejandro Gomez's corner towards Josip Ilicic, who sent a side-footed finish into the net from close range.
Joao Cancelo thumped a long-range effort just wide in the second half before an emotional Barzagli was embraced by his team-mates and hugged by his departing boss when replaced on the hour mark.
Szczesny made a superb save to send Ilicic's deflected free-kick over to keep Juve in the hunt and Mandzukic, who had replaced Barzagli, timed his run to perfection to poke Cuadrado's delivery from deep beyond Gollini.
Atalanta rise up to third
A point takes Atalanta above Inter due to their superior head-to-head record going into the final day of the season, meaning Gian Piero Gasperini's side should be confident of sealing a stunning top-four finish.