For Job hath said, I am righteous. Job had maintained his "righteousness" in a certain sense, i.e. his integrity, his honesty, his conviction that God would ultimately acquit him; but he had not maintained his sinlessness (see the comment on Job 33:9).
He had not even said, in so many words, "I am righteous." The nearest that he had come to saying it was when (in Job 13:18) he had exclaimed, "I know that I shall be held righteous," or "justified." And God hath taken away my judgment.
Job had said this (Job 27:2), but in the sense that God had withheld from him the judgment on his cause which he desired, not that he had perverted judgment, and wrongfully condemned him.