"The Rime of the Ancient Mariner" does follow the allegorical format of sin, expiation, and redemption found in a morality play.
The sin comes when the mariner carelessly kills the albatross who seemed to have brought the sailors good luck, such as favorable winds. The mariner kills...
the albatross because he can, showing his pride and arrogance. He also has no idea what he has done wrong by killing the bird.
Expiation comes as the mariner and the rest of the ship's crew are punished for the mariner's crime. For instance, they are whisked to a hot part of the earth and become parched with thirst, but there are no winds and no rain to help them out. It is as if they are on a "painted ship. / Upon a painted ocean." There is sea water everywhere, but not a drop is drinkable. Later, and more blatantly allegorically, the mariner has a vision of Death, a skeleton, and Life-in-Death, a painted woman with skin as "white as leprosy." They throw dice. Death wins all of the ship's crew, who die, while Life-in-Death wins the mariner.
The mariner's punishment continues until his moment of redemption, which comes when he sees the beautiful color of the water snakes and spontaneously praises God's creation:
O happy living things! no tongue
Their beauty might declare:
A spring of love gushed from my heart,
And I blessed them unaware.
At this point, the mariner has come to the wisdom he didn't have before, which is that all of nature is God's creation and to be treated with reverence. He now goes around and tells his story as part of redeeming himself.
We can see the mariner as the allegorical figure of human pride and arrogance who is redeemed and reenters God's kingdom when he learns humility and reverence. The albatross can be understood as an allegory for the purity of God's creation. Being in a seemingly painted ship on a painted sea is an allegory for the mariner's alienation from nature: at this point, nature is not real and alive to him. Because of this, he can get no spiritual nurture from it and so is parched. The albatross falling from his neck as he blesses the water snakes is an allegory for his release from the weight of sin.