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.
What does it mean? 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.
Zapata a constant threat
Forward Zapata has had his best season in Serie A, scoring 22 goals, and Juventus struggled to deal with his movement throughout the contest.
Barzagli bows out
Barzagli, now 38, is a shadow of the player once considered to be one of Europe's top defenders. Atalanta exploited his sluggishness in a one-sided first half before the veteran was substituted.
Key Opta facts
- Atalanta are the first Serie A team to reach the milestone of 100 goals in all competitions in 2018/19.
- Juventus failed to win a Serie A home match against Atalanta for the first time since May 2009.
- The Serie A champions have conceded at least one goal in seven Serie A games in a row for the first time since January 2011.
- Ilicic has scored 12 goals in the campaign - he is only one goal from his personal best in a single Serie A season (13 in 2015-16 for Fiorentina).
- Mandzukic scored his first goal in Serie A since the start of 2019 (his last was in December 2018 against Roma).