Jesus asks the question because he knows that the ruler will not like Jesus's answer to the ruler's question in verse 18. Jesus does not expect the ruler to answer Jesus's question. Jesus wants the ruler to understand that Jesus's answer to the ruler's question comes from God, who alone is good. Alternate translation: "You know that no one is good, except God alone, so to call me good is to compare me with God" (See: [[rc://en/ta/man/jit/figs-rquestion]])
This double negative emphasizes that God is the only one who is good. Alternate translation: "The only one who is good is God" (See: [[rc://en/ta/man/jit/figs-doublenegatives]])