A couple of thoughts come to mind as I read this:
Your son is going through a completely normal stage. Lots of kids have periods of liking one parent more than the other. They are simply being honest about their feelings, and at 2.5, your little guy is only on the leading edge of learning what empathy is. So I wouldn't punish for this, and I wouldn't make him apologize for something that is simply true for him in the moment he says it.
Trust that he NEEDS you, and knows he needs and loves you, on some deep, undeniable level. He simply doesn't have access to those feelings all the time. This level will emerge more and more in coming years, but if you start gaming him, manipulating or wheedling for more positive feedback, showing how much power he has to "hurt" you, you'll actually be giving him a very powerful emotional weapon to use against you when he IS able to be more devious (think adolescence). And if you punish for his expression of honest feelings, he'll eventually start repressing his feelings or simply shutting you out.
2. Take some time every day to play with him. If you need help imagining how to do this, get the lovely book Playful Parenting by Lawrence J. Cohen, PhD. This is a worthwhile investment in your future relationship with your little boy. I'll bet you can even get Daddy on board to give you time together while perhaps he picks up a chore or two that you would normally do.
3. You can allow him his honest feelings and still work on the messages he sends. Daddy will be able to help with this. When they anticipate your arrival, your husband would do well, at least some of the time, to key down the play and help plan a welcome home for mommy. I had to do this with my grandson when he was about 3.5 and acting rejecting or bored of his daddy. I'd shift him to a more "guy" oriented game, like soccer, that his dad could just join in as soon as he got home. After a few minutes of active play, my grandson was ready to welcome Daddy home without any sign of rejection.
At any rate, start giving him calm and consistent messages about what it's okay to say, and what is simply rude. "I would rather play with Daddy now" is fine. "Go away!" is not good manners. He needs to have alternative language, rather than just being told what not to say.
I hope this season passes quickly, J.. It is terribly hard to hear your child not wanting you after you have sacrificed and worked so hard for his happiness and wellbeing. He WILL understand what you give him better as he grows up. And he will probably have seasons where he wants to be with you more than his daddy (I'll bet that already happened when he was a tiny).