Insightful Manipulator accomplishes this
Insightful Manipulator is a 9th-level subclass feature for the Mastermind rogue, the ability is as follows (Xanathar's Guide to Everything, page 46):
Starting at 9th level, if you spend at least 1 minute observing or interacting with another creature outside combat, you can learn certain information about its capabilities compared to your own. The DM tells you if the creature is your equal, superior, or inferior in regard to two of the following characteristics of your choice:
- Intelligence Score
- Wisdom Score
- Charisma Score
- Class levels (if any)
At the DM's option, you might also realize you know a piece of the creature's history or one of its personality traits, if it has any.
Access to this feature will allow your character to know if another creature has a higher intelligence score than himself.