People seem to get confused on this point often. Copyright protects the exact words used (or pictures or sounds or whatever, but we're dealing with words here.) It does not protect a "story idea". If you copy, say, one of the Harry Potter books word for word, put your name on it, and try to sell it, that's a violation of copyright. But if you make up your own story about wizards and magic schools, as long as you do not use the same words, it is not copyright violation. Even if everyone who reads it says, "Wow, this story is a total rip-off from Harry Potter", they may ridicule for being uncreative, but you have not violated copyright.
New writers often ask the same question you're asking here but from the opposite perspective: They's say, I have this great story idea but I haven't written the book yet. How can I copyright my idea so no one else can steal it. The short answer is: You can't. You can't get copyright to an idea or a plot, only to the exact words you use to tell the story.
There are difficult cases when you copy SOME of somebody else's words but not all of them. If you copied long sections of the original poem, you could get in trouble. But if you just re-tell the same basic story in different words, you are 100% safe.