I hope that I have explained this well enough in the title as I'm aware this is a potentially unclear question! I'm currently studying Dante's Inferno as part of a wider module on Italian politics at university, and the descriptions used in the book arguably put most fantasy writers to shame. This led me to wondering, did Dante make up the contents of the Divine Comedy (albeit with the help of other sources such as the Bible) or should it be read as the recounting of an experience that he believes actually happened to him?
No, Dante did not believe that he fell asleep and was guided through a voyage of hell, purgatory, and heaven by the ghost of an ancient Roman poet. The Commedia is an exquisitely crafted, genius dream vision poem crafted around Aristotelian ethics, contemporary pastoral teaching, and one of the most important and famous spiritual/mystical texts of the later Middle Ages. As you learned in your class, it's also heavily political in who gets placed in hell and heaven, and political in a way that reflects Dante's own position.
However.
Dante is drawing on a long medieval tradition of otherworldly visions and voyages that informed/influenced/created his and his contemporaries' ideas of what heaven, hell, and purgatory looked like! Unlike Dante's work, these texts, like the Visio Tnugdali's hell voyage or Mechthild of Hackeborn's raptures into heaven in the Liber specialis gratiae, were recorded and accepted as actually having happened. So things like the contrapazzo punishments--hell (and purgatory) divided up by types of sin and everyone receiving their punishment as befitting their chief sin--go back centuries.
Notably, the use of placement in hell to criticize one's political and ecclesiastical circumstances also goes back centuries...
But more to the point here, because vision texts believed to be authentic and 'fictional' dream vision poems both circulated in the Middle Ages, and by Dante's day people were just starting to be concerned about potential fraudulent visionaries, medieval authors developed a series of measures to distinguish "true" from "invented" visions. (Scholars of course emphasize that even "true" visions are a literary creation in that we only have the text, not the experience itself, so there is conscious human crafting of the perceived rapture/divine encounter regardless). The most important was, well, the author's reputation as a divinely-gifted visionary, which was...not Dante. Additionally, sleep/dreams are more generally a plot device in invented dream narratives, like Piers Plowman or the Roman de la Rose or the Pearl. And 'authentic' vision texts often contain some kind of insistence on that particular fact.
If you're interested, I have earlier answers about some of Dante's influences in the 'authentic' vision category:
I tend to use Mechthild of Magdeburg's work because she's my favorite (and also because her vision of hell is A+), but you should know that scholars of medieval women's writing/religion generally think Mechthild of Hackeborn is Dante's "Matilda."
OP, you might consider x-posting to /r/AskLiteraryStudies for their take on this major work of Italian literature