And Jesus said unto him, Why callest thou me good? none is good save one, even God.Mark 10:18 ASV
It is a mistake to suppose that Jesus denies his own sinlessness, or disclaims divinity.
The perfect goodness of God was a universal doctrine of Judaism, and it is evident that the Lord was here building the young man’s thoughts toward the recognition of Jesus as God.
It is the equivalent of our Lord’s saying, “Look, don’t you know that if I am good, as you say, then I am therefore God?”
Of course, the Arian heresy was partially founded upon an interpretation of these words which alleged that Jesus here uttered a disclaimer of absolute oneness with God.
If Jesus did have any limitation of himself in mind here, it would have been the limitation inherent in the incarnation, and was not in any way a diminution of his claim of deity.
In an absolute sense, goodness belongs to God the Father alone.
By contrast, the goodness of Jesus was in some sense subject to growth and testing in the circumstances of the incarnation wherein he learned obedience by the things which he suffered (Hebrews 5:8).
The explanation of it, I think, is that Jesus had the nature of man … So long as he felt the emotions to sin in his members, he did not call himself good, nor did the Holy Spirit call him perfect (Hebrews 5:8).