How do you know weather a food is masculine or feminine?
Most of the time, feminine words end in a double consonant + e (mme, tte, nne etc.) or just a plain 'e', although this isn't always the case.
Genders are tricky so it's best to just know the word.
There isn't a general rule but you can guess as it's mostly the same in other languages. (there are exceptions) You'll learn it as you progress and read more in french.
Yeah, you really have to learn this word by word. There aren't any rules to govern this.