There isn't a specific rule. You just need to practice.
But in general nouns ending in:
-il, -ail, -eil, -ueil
-é (but not -té)
-eau and -ou
-i, -at, -et and -ot
and words ending in other consonants (in the spelling)
--> refer to masculine nouns
And nouns ending in:
-tion, -sion and -son
Consonant followed by -ie
Most other endings consisting of Vowel + Consonant + e: -ine, -ise, -alle, -elle, -esse, -ette etc.
--> refer to feminine nouns
I wouldn't advice you to learn that by heart. But by practicing French very often you will naturally be able to identify whether a noun is masculine or feminine.