Not necessary at all.
I mean even if you're writing good'ol tonal music, there's so much that at a composer can only really learn by writing and hearing what they wrote, that any of the typical ear-training crap makes no difference.
Then there's of course the deal with why bother learning how to "sing melodies" when your music doesn't use them that way. I mean I doubt anyone would berate Schoenberg because he couldn't sight-sing his 12 tone pieces.
On that note, I only learned how to sight-sing for an exam, after that I never, ever, used it again. Likewise with 99% of the "training" you have to endure in the typical ear-training courses. I have never, ever, thought "Oh thank god I did that course!" at any moment, ever. Instead I hated wasting time.
And of course the practice of melody dictation was maybe a great thing to have in 1700, but it's entirely pointless these days for a composer. I mean if you want to figure out something by ear, you're MOST likely going to be able to if you keep trying. Hell I used to play a lot of music by ear on guitar, and it didn't help at all in my exams. I still play a lot of stuff by ear and improvise/jam with people frequently, but THESE "ear" skills aren't appreciated by any of the ear-training courses I had to take. Quite irritating.