It's difficult for us, too, and I think it's advanced Japanese when it's read あま and あめ. Generally they are used for the phrases from old Japanese language. Now, in everyday conversation, we rarely use あま and あめ. I think there are rules but they aren't very clear. So one of the best ways would be remembering how to read it in each case.
I hope this helps you.