Unless you're tone deaf or otherwise physically or mentally impaired in regards to your ability to make music I feel pretty strongly that anyone can make good music if they put in the time.
Everyone knows what 'good' music sounds like (respective to their own tastes). When you hear a song you instantly know whether you like it or not. Learning to write music has nothing to do with learning what 'good' music is. Writing music is a twofold process; learning how to identify what you actually like about the music and learning how to use your tools to make what you have identified as good.
Your first step should be to work really hard to understand the music that you enjoy. For some people that means classical training and for others that means just listening really closely to a lot of music. Once you understand some of the keys elements that make up a song you like you have to start experimenting or googling a lot of stuff in order to foster similar techniques.
Being honest with yourself is important in that you have to try your best to identify whether a particular melody, sound, or song that you're working on is something that you personally enjoy. If it's not, keep working at it, if it is then you've done it! Don't worry about what other people think, if you can objectively say that the music you've made is something good then that's what matters and there are certainly others who will agree.