Let me point out first that a diminished chord and a dominant b9 with the same root can't be the same chord.
So that said, the clue I think is the Ab, which is the b9 of what?
Ab is the b9 of G. Specific to this example, we're talking about chord/scale relationships, as they're often called. Given a chord like G7b9, the scale that corresponds to all the notes that work with that chord are Abdim -- or Bdim, Ddim, Fdim, and Abdim, because those are all the same scales/notes, they just start from a different place in the scale. There are only 3 unique diminished scales in that way, because of their symmetry of whole-half-w-h-w-h-w-h steps. Some people like to start them from yet another different note, so the first interval is a half step instead. You could think of a diminished scale applied to a G7b9 as being a G half-whole diminished scale if you want to -- G, Bb, Db, or E half-whole dim scales, because they're all the same. (Muddied the waters enough yet?!)
🙂 Me, if I'm thinking, I think in terms of whole-half dim scales applied to altered dominants from the b9. It's just habit.
Here's a stacked voicing of a G7b9, and a diminished scale spelled from G -- but it's a B, D, F or Ab dim. scale, they're really all the same, just starting from a different note. Notice it has a perfect 5th as applied to the G chord (i.e. a D); that's not unheard of, but more often the 5th on an altered dominant will be either sharped or flatted too (a D# or Db). The chord symbol will sometimes say so, as in G7b9b5, but not always, you might consider it implied, or you might prefer the perfect 5th. Altering the 5th too is a different chord/scale relationship, you'd apply (in the case of G7b9b5 or G7#9#5) a B lydian augmented scale -- a lydian aug from the 3rd of G. Lydian augs aren't like diminished scales, there are 12 of those, while there are only 3 unique diminished scales. That's due to lydian aug construction in half and whole steps: W-W-W-W-H-W-H.
I mean this to be helpful, if it's just irritating please tell me and I'll refrain from all this. I am in fact (if you hadn't noticed yet!) a terrible teacher. If you like I can recommend some books or better instructional materials that would make better sense of it than my humble attempts. It might seem overly complicated, but if you work with them awhile it kind of trains you to consider it normal. While playing, it results in thought things like "I'm playing a G right now and that's the root, but I'm going to a C chord and it'll be the 5th, then a Bb chord it'll be the 6th, then Ab it'll be maj7th", and it all just flows along naturally without any conscious thought, dealing with them as just their sounds and not all this structural/theory stuff. In the end, it's really ear training.