If God loved Job why did He afflict Job with so much suffering?
Job by God’s estimation was a righteous man.
The question posed is is Job righteous because he enjoys God’s blessing?
To put Job’s faith to the test he is first afflicted with great loss – his family and his wealth.
When Job passes this test (as it were) as God knew he would, he is then afflicted with physical illness.
Job’s three friends say that his great affliction is clearly punishment from God for a serious secret sin.
They counsel him to confess and repent.
Job knows he has not committed a serious sin and that God doesn’t usually punish people in this life for their sins because wicked men prosper in this life.
Nonetheless he thinks that God is targeting him unfairly for something he hasn’t done.
Job trusts God implicitly and believes in a future resurrection and redemption.
The main lesson is that affliction in this life is a test of faith, not a punishment for sin.
There are a number of other lessons to be learned from the book of Job.
More than I can cram into an answer here.
May I suggest that you go here for an exposition:
Lessons from Job (please click on the link)
I hope you find this helpful.