The main argument in Job is that it is important to maintain faith, especially in the times of greatest adversity. As a corollary, it shows that one should never give in to despair. Faith in God (in this case, Yahweh) is needed even more, Job's trials show, when everything seems most hopeless. Further, doubting God can bring his retribution for lack of faith.
Job was initially blameless and was being tested as part of a contest about the nature and extent of faith. He believed that he had done nothing that would justify all the misfortune, pain, and suffering he had to endure. And he was right. His real problems started when he complained too much about the unfairness, which was seen as questioning God and thus demonstrating a lack of faith. Ultimately he accepted the wisdom of God's will and, no longer feeling forsaken, did not succumb to despair.