Sorry, but you don't understand the context of that story. Jesus' comment about the goodness of God has two objectives.
The first is to expose rich young ruler's self-righteousness. The man asks about the everlasting life. Christ tells him that only God is good and advices him to keep the commandments. For which the guy says, I have kept them all since my youth. In other words, he told Jesus that he himself is good. No one except the Messiah kept the law perfectly, but there we have a man who claims that keeping it is a piece of cake. Have you ever read Psalm 14 young ruler?
1 The fool a says in his heart, “There is no God.” They are corrupt,
their deeds are vile; there is no one who does good. 2 The Lord looks
down from heaven on all mankind to see if there are any who
understand, any who seek God. 3 All have turned away, all have become
corrupt; there is no one who does good, not even one. 4 Do all these
evildoers know nothing? They devour my people as though eating bread;
they never call on the Lord. 5 But there they are, overwhelmed with
dread, for God is present in the company of the righteous. 6 You
evildoers frustrate the plans of the poor, but the Lord is their
refuge. 7 Oh, that salvation for Israel would come out of Zion! When
the Lord restores his people, let Jacob rejoice and Israel be glad!
Your own scriptures testify that you are delusional, young man.
Secondly, Jesus hints here that He Himself is God. If only God is good, and you, young ruler, called me good, what does that make Me?
Psalm 117 in Septuagint (118 in the MT), for example, calls God good (agathos) five times. In the Hebrew version, it contains the word salvation (יְשׁוּעָה), which is Jesus' name, three times.
1 [Alleluia.] Give thanks to the Lord; for [he is] good: for his mercy
[endures] for ever. 2 Let now the house of Israel say, that [he is]
good: for his mercy [endures] for ever. 3 Let now the house of Aaron
say, that [he is] good: for his mercy [endures] for ever. 4 Let now
all that fear the Lord say, that [he is] good: for his mercy [endures]
for ever. 5 I called on the Lord out of affliction: and he hearkened
to me, [so as to bring me] into a wide place. 6 The Lord is my
helper; and I will not fear what man shall do to me. 7 The Lord is my
helper; and I shall see [my desire] upon mine enemies. 8 [It is]
better to trust in the Lord than to trust in man. 9 [It is] better to
hope in the Lord, than to hope in princes. 10 All nations compassed
me about: but in the name of the Lord I repulsed them. 11 They
completely compassed me about: but in the name of the Lord I repulsed
them. 12 They compassed me about as bees [do] a honeycomb, and they
burst into flame as fire among thorns: but in the name of the Lord I
repulsed them. 13 I was thrust, and sorely shaken, that I might fall:
but the Lord helped me. 14 The Lord is my strength and my song, and
is become my salvation. 15 The voice of exultation and salvation is
in the tabernacles of the righteous: the right hand of the Lord has
wrought mightily. 16 The right hand of the Lord has exalted me: the
right hand of the Lord has wrought powerfully. 17 I shall not die,
but live, and recount the works of the Lord. 18 The Lord has
chastened me sore: but he has not given me up to death. 19 Open to me
the gates of righteousness: I will go into them, and give praise to
the Lord. 20 This is the gate of the Lord: the righteous shall enter
by it. 21 I will give thanks to thee; because thou hast heard me, and
art become my salvation. 22 The stone which the builders rejected,
the same is become the head of the corner. 23 This has been done of
the Lord; and it is wonderful in our eyes. 24 This is the day which
the Lord has made: let us exult and rejoice in it. 25 O Lord, save
now: O Lord, send now prosperity. 26 Blessed is he that comes in the
name of the Lord: we have blessed you out of the house of the Lord.
27 God is the Lord, and he has shined upon us: celebrate the feast
with thick [branches, binding the victims] even to the horns of the
altar. 28 Thou art my God, and I will give thee thanks: thou art my
God, and I will exalt thee. I will give thanks to thee, for thou hast
heard me, and art become my salvation. 29 Give thanks to the Lord;
for he is good: for his mercy [endures] for ever.