Haven't tried it myself but over in this thread "netem" was brought up a couple of times.
As far as I can tell it's not exactly what you're looking for as it seems it can only add a static delay and you seem to be looking for something that dynamically adjusts the added delay but it might be worth trying.
I'd caution you though to
- don't go too far the rabbit hole if you look into the thread I linked and
- be mindfull that there's a thin line between "leveling the playing field yourself" and cheating.
Also keep in mind that the ping that Ookla shows varies a lot from the ping to actual game servers like https://gameserverping.com/ or even better yet in-game ping monitors will show.
In my case Ookla will pick the server fastet/closest to my place and show 8/12/8 idle/down/up while the closest game servers will typically have a ping between 40-70ms.
So you might not even have to adjust anything.