This is the kind of question which might seem trivial but can actually be quite challenging. So if you’re not sure if you can do it: don’t be embarrassed!
Both the bass line and the main melody are essentially “tunes”, normally played one note at a time, wandering around the scale of the key the song is in. This means that it’s easy for your ear to follow the bass line instead of the melody and vice-versa.
There are however some tips and tricks you can use, and several different ways you can train your ear to distinguish bass line from melody. Here are some we’d suggest:
Tip #1: Difference in Pitch
It is almost always the case that the bass part (practically by definition!) is lower in pitch than the melody. Normally the bass line is played on a bass guitar, acoustic bass, or synthesized bass instrument, which all have low-down pitch ranges and tend to mostly play notes in the lower end of that range. By contrast, the melody is most often in a higher region, either because it is sung or played on an instrument chosen to stand out by rising above the rest of the mix.
This means that some basic pitch ear training can help you to tune your ear in