A:Respected Brother/Sister in Islam
As Salaamu Alaykum wa Rahmatullahi Wa Barakaatuh
Haamidaw wa Musalliyaa
Your query below refers;
Though finding out the sex of the child is not prohibited, it is not preferred. This will not be permissible if the awrah is exposed solely for this purpose.
And Allah Ta'ala Knows Best
Shafiq Jakhura (Mufti)