tabs are a good way to get an idea. i would often use them when i was a kid, but i wouldn't treat them as gospel. they're like sparknotes or something. but the good thing is that there are often multiple tabs, so some have some things right. you can put together an aggregate in your head of the multiple tabs. then you can fill the rest in with your ear where you disagree.
at this point it's easier for me to use my ears than trust a tab. or a lot of times my hands don't agree with the fingering on a tab. i never really worked on it, it just came over the years. or at least, the way i worked on it would be to audiate melodies in my head and get an idea of how they looked if i played them on the fretboard, when i was away from the guitar (or upright bass). less cause i wanted to actually do this, and more as a weird compulsion when i was bored, like how some people incessantly count stuff.
what helped me is the first stuff i learned on guitar was like nirvana, foo fighters. then like zeppelin after that. there's a lot of stuff they have that it is either power chords or clear single note riffs, so they're not too hard to figure out. a hell of a lot easier to figure out than like, some joe pass arrangement or something with a lot of weird chords or phrases. but even for the latter, if i slow the record down and play it a million times, it stays in my head more than just reading a tab, which i forget immediately.