In a sense, it is both. This was a real individual and he had real troubles, and these were fairly well described in the Bible itself, although the story has undergone some modification and changes in the retelling prior to the point it was transcribed in a way that could survive translation into multiple languages without being degraded. The same is true for much in the Bible, that there have been many errors of translation and distortion of meaning and embellishments, as well as heavy editing and deletions to control the content and the ultimate messages.
In the case of Job, this is less the case, so the story survives as a testament to the trials and tribulations of a man facing his karmic consequences and being put through a hellish ordeal in the process. As such, it makes a quite powerful object lesson of the importance of reckoning with your own choices and outcomes to mitigate any damage created, or done to you personally, as karma will take those energies and project them forward and, in this way, you will meet up with them again and suffer a fate that corresponds to the nature of the energy being unleashed. You need not fear good deeds, as you will receive rewards and blessings, but any transgressions, failings, harm caused to the self or others, will be revisited on you in some way or another in the form of an opportunity to make amends either by contributing loving kindness to someone or the self, or as a way to take on the negativity you caused someone else and thereby cancel the karmic obligation.