There’s an extension that adds the function to check for Steam Deck.
Other than that, your best bet would probably be to check for things inside os_get_info().
I don’t have a Steam Deck so I cannot test anything related to this.
I’m also surprised that anyone uses the extension with Steam games considering that it seems to cause anomalies with Steam overlay.