You can try the following query to show the custom attributes for the user
$select=displayName,onPremisesExtensionAttributes
will show only the display name along with all the custom attributes
--please don't forget to upvote
and Accept as answer
if the reply is helpful--