Using the masculine pronoun “He” when referring to Allah, may He be exalted
Question

                Why when refering to Allah in the Quran or Hadeeth we say HE or HIM how do we know that allah is a he, I had a non muslim girl come up to me saying why dont you say she or her why is it you say he?.
Praise be to Allah.We do not know to whom we should address our answer. Should we speak to you, as you are the one who put this question to us, or should we address that girl with whom the Shaytaan is toying and causing her to say audacious things about Allah, may He be exalted, when He is giving her respite? She has not stopped at disbelieving in Him; rather she has gone further by trying to express her foolish ideas, that anyone with (sound) reasoning would not accept even if he was a disbeliever like her. And you – and here is the cause of the problem – are listening to her and you think that she said something worth asking about and are anxious to find an answer for her. 
Whatever the case, we are concerned now for you, because she did not ask us and she is not a follower of our religion such that we could give her an answer on the basis of what we believe, although our answer will, in sha Allah, be appropriate to answer her too, if she is one of those among her people who possess reason. 
You should know that the reason for this girl’s question is her ignorance of the Arabic language that we speak and, indeed, her ignorance of other languages. 
The linguist Abul-Fath ibn Jinni said: Chapter on that in which knowledge of Arabic could ensure sound understanding of religious beliefs. It should be noted that this chapter is one of the most important chapters in this book and that the benefit thereof is very great indeed. That is because for most of the Muslims who went astray from the right path and drifted away from proper understanding, what caused them to go astray and go against what reason dictates is their weak understanding of this noble language through which all of mankind are addressed, and the ultimate fate of a person, whether in Paradise or Hell, is connected to understanding this language…. End quote. al-Khasaa’is, 3/248 
It should be noted that one of the basic principles of communication is that everything is to be spoken of in such a way that it makes it stand out and distinguishes its gender. This is an ancient phenomenon in human languages, but there are some things that have nothing to do with real gender, as is the case with inanimate objects such as stones and mountains, and concepts such as justice and generosity, and so on. In these cases, masculinity and femininity are not applicable in the true sense of these two words. It seems that this is the reason why some languages divide nouns into three categories: masculine, feminine, and a third category which in Indo-European languages is called neuter; this refers to that which is neither masculine nor feminine. 
But not all human languages have this category. Semitic languages, for example, divide nouns of the third category, which is neuter, between the first two categories. So nouns in these languages are all either masculine or feminine. 
This is also the case in the French language, in which all nouns can only be either masculine or feminine. English differs from French in this regard. 
See the Introduction by Dr. Ramadan ‘Abd at-Tawwaab (may Allah have mercy on him) to the book al-Bulghah fi’l-Mudhakkar wa’l-Mu’annath by Ibn al-Anbaari, 37-39 
Now we know that dividing things into masculine and feminine – even in the case of that which cannot really be described as such – is the feature of most languages, especially living languages that are spoken now, and this is not something that is unique to Arabic. So now you know that if it is possible to describe anything as being either masculine or feminine, when it cannot be described as such in any real sense, then a language may prefer to speak of something in the masculine, as that is easier and it is the basic principle; there is no need to add any specific marker [such as an extra letter or syllable to indicate the feminine], as the feminine stems from the masculine.  
The imam of the grammarians, Seebawayh (may Allah have mercy on him) said: It should be noted that the masculine form is easier for them to use than the feminine, because the masculine form is the original and is more established (in the language), and the feminine form is derived from the masculine. Do you not see that the word ash-shay’ (thing) is applicable to everything that we know about, regardless of whether it is masculine or feminine, and the word ash-shay’ is a masculine noun. 
Kitaab Seebawayh, 1/22; see also 3/241 
If the matter may be either of two things, but one of them is more likely than the other, even in one sense, it then becomes inevitable that the Lord should have the nobler and more sublime of the two.
As-Sawaa’iq, 4/1308 
Hence you will find that most of those who believe that there is a God above the heavens refer to Him in the masculine, which is more befitting to Him, may He be glorified. This is something natural that does not need any research, examination or evidence. You will not find anyone, knowledgeable or ignorant, monotheist or polytheist, who does not refer to God, may He be exalted, as “He”. If anyone were to refer to Him in the feminine, as this poor girl said, he would be opposed and accused of ignorance and clear misguidance. 
So how about if we add to the above what Allah, may He be exalted, has said of Himself in His holy Book – and indeed in all the revealed Books – using that (masculine) pronoun. 
Allah, may He be exalted, says (interpretation of the meaning): 
“It is He Who has created the heavens and the earth in truth, and on the Day (i.e. the Day of Resurrection) He will say: "Be!", - and it shall become. His Word is the truth. His will be the dominion on the Day when the trumpet will be blown. All-Knower of the unseen and the seen. He is the All-Wise, Well-Aware (of all things).”
[al-An‘aam 6:73]
“And He it is Who originates the creation, then will repeat it (after it has been perished), and this is easier for Him. His is the highest description (i.e. none has the right to be worshipped but He, and there is nothing comparable unto Him) in the heavens and in the earth. And He is the All-Mighty, the All-Wise.”
[ar-Room 30:27]
“It is He (Allah) Who is the only Ilah (God to be worshipped) in the heaven and the only Ilah (God to be worshipped) on the earth. And He is the All-Wise, the All-Knower.”
[az-Zukhruf 43:84].
And there are many similar verses, too many to list here. 
Moreover, Allah, may He be exalted, criticised the mushrikeen (polytheists) for their claim to worship Allah, the One, the Subduer, yet they worshipped females besides Him, and He criticised them for that and explained how abhorrent their deeds were. Allah, may He be exalted, says (interpretation of the meaning):
“They (all those who worship others than Allah) invoke nothing but female deities besides Him (Allah), and they invoke nothing but Shaitan (Satan), a persistent rebel!”
[an-Nisa’ 4:117]. 
Imam at-Tabari (may Allah have mercy on him) said: Here Allah, may He be glorified, is saying: With regard to these people who associated others with Allah and worshipped idols and rivals, it is sufficient evidence against them of misguidance, disbelief and going astray from the right path, to note that they worshipped females and called them “gods” and “lords”, when the feminine of any thing is inferior, and they affirmed their servitude to that which is inferior of any thing, even though they knew that it was inferior, and they refused to devote sincere worship to the One Who is in control of all things and in Whose hand is the creation and the commandment.
Tafseer at-Tabari, 9/211, Mahmoud Shaakir edn. 
Shaykh Ibn Sa‘di (may Allah have mercy on him) said: That is, these mushrikeen do not call upon and worship besides Allah anything but that which is feminine, namely idols and statues with feminine names, such as al-‘Uzza, Manaat and so on. 
It is well known that the name is indicative of the thing that is named. If the names are feminine and inferior, that may point to some inferiority in the thing that is thus named, and they suggest that it is lacking attributes of perfection, as Allah has told us in more than one place in His book that they cannot create, provide or protect their worshippers, or even bring any benefit or ward off any harm from themselves, and they cannot defend themselves against anyone who wants to harm them; they cannot hear or see or understand. So how can the one that is like that be worshipped instead of the One to Whom belong the most beautiful names and sublime attributes such as praiseworthiness, perfection, glory, majesty, might, beauty, mercy, kindness, compassion, the unique power to create and control, and great wisdom in all that He commands and decrees? 
Is that not the most abhorrent thing that is indicative of a person’s imperfection and reaching the lowest level of baseness that is worse than anyone could imagine or describe?
End quote from Tafseer as-Sa‘di, 203. 
However, we would like to point out that Allah, may He be exalted, cannot be described as masculine or feminine in any true sense; rather that (use of the masculine pronoun) is necessary for the purpose of communication in human languages and what people need in communicating ideas about Allah. Everything that is either masculine or feminine is something that is created and Allah, may He be exalted, is the Creator of the masculine and feminine.
“And that He (Allah) creates the pairs, male and female”
[al-Najm 53:45]. 
Exalted be Allah above having any rival or peer, spouse or child.
“He is the Originator of the heavens and the earth. How can He have children when He has no wife? He created all things and He is the All-Knower of everything.”
[al-An ‘aam 6:101].
Allah tells us about the believers among the jinn that when they heard the Qur’aan, they believed in it and acknowledged their Lord, may He be glorified:
“And exalted be the Majesty of our Lord, He has taken neither a wife, nor a son (or offspring or children).”
[al-Jinn 72:3].
What you have to do is tell her to look into her Scripture, if she believes that there is a God who sent a Messenger and revealed a Book to him; let her look in it and learn why. 
If she burst with anger and her heart was filled with anger because she is female and Allah, may He be exalted, cannot be described in the feminine, then kufr in our times has reached such a level of craziness that you find a female wanting to stand up for her gender, on the basis of truth or falsehood, like the attitude of those who are ignorant and feel inadequate, so they try to compensate for that even on the basis of falsehood. 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: The one who defends himself on the basis of falsehood wants to defend everything he says, even if it is wrong.
Majmoo‘ al-Fataawa, 10/292 
If the ignorance and feeling of inadequacy has reached the level of likening Allah to His creation and even to the female of His creation, this is a state that even the ignorant Arabs in their worship of idols did not reach, for they knew that Allah, the Creator and Provider, was far greater than those idols and it was not befitting that He should be like them. 
Beware of every ignorant heretic and remember that a person would follow the religion of his friend, so watch you make friends with. 
“Glorified be your Lord, the Lord of Honour and Power! (He is free) from what they attribute unto Him!”
[as-Saaffaat 37:180]. 
And Allah knows best.