Python 3.8 should be the standard python for (almost) all distributions by now.
If you don’t want to / can’t upgrade your distribution you can just download the python binaries and install them. There is no need to compile python yourself.
E.g. this will install python 3.10.2 - just make sure to use the latest version which would be 3.10.5 and modify the script accordingly. This would be a step by step tutorial.
Is this a fresh install or an existing, older install of openhabian?