I trying to write a few verses and knowing the gender might change the meaning. A good source to Sanskrit grammar would also be accepted!
Apte's dictionary (http://dsal.uchicago.edu/dictionaries/apte/) is also a great resource for learning the लिङ्गम् of words. However, the most authoritative source would be a कोषः such as अमरकोषः, मेदिनी etc.
The अमरकोषः has words arranged in categories (for e.g names of Gods, plants, etc.) and is in verse form. Where applicable, the verse also indicates the gender of words. For e.g here's one verse that gives synonyms for the word
दिशस्तु ककुभः काष्ठा आशाश्च हरितश्च ताः ।
ताः at the end signifies that each of the words in this verse are all in स्त्रीलिङ्गः (feminine) only:
दिशः ककुभः काष्ठाः आशाः हरितः
Some words appear in all three genders, and these are also marked appropriately by the usage of special words in verses. I've seen
पुम् to denote
स्त्री for feminine.
Here's another example that enumerates synonyms of
सुरलोको द्योदिवौ द्वे स्त्रियां क्लीबे त्रिविष्टपम्
सुरलोकः is obviously in पुँल्लिङ्गः but the next two words (i.e nominal stems)
द्यो (प्रथमा-विभक्तिः forms are
द्यौः द्यावौ द्यावः)and
दिव्(प्रथमा-विभक्तिः forms are
द्यौः दिवौ दिवः) are in स्त्रीलिङ्गः Finally त्रिविष्टपम् is in नपुंसकलिङ्गः
There's a commentary on
अमरकोषः written by Bhanuji Dikshit and published by Chowkhamba. It contains all verses and a brief commentary to each verse where the derivations of some words is demonstrated with Panini's rules.
Sanskrit grammar is an ocean and takes several years to learn. The best way to get started is to find a teacher/scholar in this subject. If you have some foothold in the basics, you can view recordings of Siddhanta Kaumudi here: http://ggss-lessons.org/ or from youtube https://www.youtube.com/channel/UCp5mvCwXR-drTRyzNUUjdZg/
http://avg-sanskrit.org/ has enough material to keep one busy for a few years - the daily examples show how to use Panini's rules to derive words. Video recordings of select portions of Ramayanam, Raghuvamsam, Introduction to Sanskrit and Panini's rules are also available: https://www.youtube.com/channel/UCYDCfgWlp6dlFr_vVTEVJrQ