My 3.5yo dd is just getting over this exact behavior. When she was barely a year old she would tell me, "I don't like babies!" Even when she was a year old, she didn't like 2yo's. When she was 6mo she would crawl towards babies and headbutt them! Once in the grocery she spotted one who was about her age--maybe 14months--and she ran all the way down the aisle and pushed him down. She's a loving girl, very smart and very stubborn and opinionated. She's also incredibly advanced verbally and used to get really frustrated when kids couldn't communicate.
What finally worked for us was role playing--a lot--on the playground and with dolls. I would make it very upbeat and fun and try to do it when she wasn't expecting it. She would get territorial on the top of the slide or when she felt crowded. So we'd be playing and talking and I'd ask her, "Oh, what should we do if a baby comes up here?" No matter what her answer was, I never said no or corrected her. If she said she would tell it to go away, I'd just tell her what I would do differently. When she said she would let it go down the slide, I'd be overly happy and proud of her and give her a big hug and a kiss and leave it at that. I was always relaxed and having a good time with it so it wasn't like a lecture.
I think the key was the timing. I did it when we were having fun and there weren't any imminent baby threats so she had time and space to think about what she should do. That way she had a very positive association with the appropriate way to behave in what was otherwise a negative experience for her--baby threats. :P
She was a little over 2 when I did that.
Oh yeah, another thing I did was tell her that when she saw the babies coming, get out of the way as fast as possible so it became a game. It's not a long-term solution so much, but kids love to be chased and it usually worked in the moment. I'd just tell her, "oh no, here comes a baby! Quick down the slide, down the slide!" She would scream and escape the baby as fast as she could. That could hurt an older kids' feelings, though, unless you involve them in the game. We did that with little babies.
HTH. Believe me, I know what you're going through! My kid is nicknamed Lolo The Bull because of her baby-headbutting days! Now that she's older, though, she's using her toughness much more appropriately. The other day a little boy was razzing DD1, who is almost 6 and very sensitive, and DD2 charged in and took control. Very cool!

It always gets better.