The Rime of the Ancient Mariner (originally The Rime of the Ancyent Marinere) is the longest major poem by the English poet Samuel Taylor Coleridge , written in 1797–98 and published in 1798 in the first edition of Lyrical Ballads .