While the Reverend Dimmesdale's inner torture of guilt from his secret sin leads him to attempts at confession, the irony, or contrast between what he expects and what does happen, is that instead of hearing his admission of sin and condemning him as they have done with his partner in adultery, Hester, the congregation believes that the minister humbles himself as the saints of old did in order to relate to others. Thus, he becomes even more popular with the congregation because of his inner troubles and sin:
While thus suffering under bodily disease, and gnawed and tortured by some black trouble of the soul, and given over to the machinations of his deadliest enemy, the Reverend Mr. Dimmesdale had achieved a brilliant popularity in his sacred office. He won it, indeed, in great part, by his sorrows. (Ch. XI)
Indeed, it is one of his sardonic commentaries on Puritanism that Hawthorne makes at this point in the novel as foolishly the Puritans think,
"The saint on hearth! Alas, if he discern such sinfulness in his own white soul, what horrid spectacle would he behold in thine or mine!"
It is also ironic that Dimmesdale cannot receive from the Puritans that which they so readily dole out; namely, punishment. The rusted and weather-beaten door of the prison from Chapter I is not opened for the minister who request it when it so frequently is used for others who would eschew it. So, ironically, too, while Hester is condemned and ostracized for her adultery, Dimmesdale's adultery affords him sympathy and love.
...this very burden it was that gave him sympathies so intimate with the sinful brotherhood of mankind; so that his heart vibrated in unison with theirs....
And, in yet another irony, "The people knew not the power that moved them thus." That is, the congregation does not understand that it is their own guilt and sin that aligns them in sympathy and love for the minister; in fact, their affection is proof of their own secret sins.