An eighth minute Carlton Morris goal was enough to secure Accies top flight status for a third successive season.
The victory, coupled with Partick’s win over Kilmarnock, means Hamilton avoid the dreaded playoff.
The on-loan Norwich man produced a neat turn before firing a left-footed strike past Scott Bain into the far corner.
Nick Ross should’ve pulled Dundee level midway through the first half when Kane Hemmings laid the ball on a plate with the goal gaping but he somehow produced a Patrick Robertsesque finish.
Two minutes after the restart the impressive Eamonn Brophy looked to have fired Accies into a two-goal lead when the ball broke to him after a 50-50 between Gramoz Kurtaj and Daryll Meggatt.
However as Dundee were set to take centre, the referee Stuart McLean ruled the goal out for offside after a lengthly discussion with his assistant Graham Chambers.
Hamilton remained resolute however and kept the Dark Blues at bay while Greg Docherty really should’ve put the icing on the cake in stoppage-time when through on goal but he fluffed his shot wide.
Speaking after the game, Accies boss Martin Canning was thrilled to steer them to safety.
“That’s our third consecutive season in the division, we’ve had some ups and downs over the course of the season but our aim was to stay up and we’ve achieved that.
“We watched last week’s defeat to Kilmarnock to see where we made mistakes and I’m delighted how we bounced back, I thought we were excellent today.”
Meanwhile Dundee manager Paul Hartley cut a despondent figure at full-time.
“I’ve no complaints about the result, it was a real flat performance today, I thought there was a lot of free-kicks against us, it was stop-start and a lot of time wasting but today in terms of the performance it was really f*****g low.”