Short answer:
You basically can't.
Long answer:
If you're in a very controlled environment (such as a custom map) you could check for things happening that could only occur if a player has a certain OP power, including but not limited to
- them joining eventhough the server is full (a Realm has 10 slots, so if someone joins as the 11th player you know they at least have OP permission lvl 0). This has the caveat that you need to know the slot amount, which is a setting in the server and cannot be checked by commands.
- them teleporting around when your datapack isn't doing that. Be careful with this, as operators can also always affect other players, so it's not necessarily the person who teleported who is the OP.
- them changing gamemode. Again, it might not be them who is the OP.
All of these are quite unreliable or require you to have further knowledge of the server your map is running on, so they are questionable and unreliable and really shouldn't be used by anyone to determine if someone is OP.
The best course of action is generally to assume that nobody playing the map is OP.
Situation based answer:
Pretend there is nobody who is OP.
Since you're asking is in the context of realms maps, the solution here is really simple: Everyone should be able to change options, not just Operators. You should treat everyone as if they aren't OP (because they are) and make it so your settings/interfaces don't require OP to use them.
So if you're relying on OP players to do something, like fly to an elevated position you can't get to in survival/adventure, changes scoreboard scores to change settings, etc. you have to find a way for people without OP to do these things as well (e.g. using signs instead of commands to change settings in an for anyone easy to access area).
For Realms you can generally assume that players are friends / in communication with each other, so that its fine for anyone to change the settings.