The book of Job is a complex and a bit of a mysterious book. It is one of the Wisdom and Poetry books in the Bible, and it uses highly sophisticated form and language — it is poetry. However, it's first of all good to appreciate that over 1/4 of the Old Testament is poetry (it was a common and ideal form of communication the ancient world), and that it is historical and true. For example, we know that King David was a real person, and that his poetry was both rooted in history and prophetic words that looked forward to Christ.
The book of Job is ancient poetry! It was written before the Exodus, and could even be contemporary with or earlier than Abraham. We don't know who wrote it. Some have suggested Job himself, or some prophet at his time, or perhaps Moses or Solomon. But whoever wrote it was clearly very wise and was moved by the Holy Spirit in writing it. Whether this is a literal recording in the sense that Job and his friends spoke sophisticated poetry or if it’s a poetic but faithful retelling of true history, I don’t know. I may be inclined to think of it as a poetic retelling, but either way, it’s true, historical, and prophetic, but poetic in form.