Of course you should tell him it’s not his. Why is not telling him even an option? Did I just fall into “opposite dimension,” where everyone does the opposite of what they should do? Not telling him that you’re carrying some other guy’s baby is about the worst thing you can do. What, are you going to wait until the baby’s born and hope it works out when he realizes that it looks nothing like him? It’s moments like these when I worry about the future of human civilization.
You have to tell him immediately. Did you cheat on him? He’d probably like to know that as well. Where’s the baby’s actual father? Why aren’t you telling him? Why is your boyfriend getting saddled with a kid that isn’t his responsibility? Why does the other guy get a “get out of baby daddy jail free card” so he can go impregnate other girls all the while unaware that he has a son or daughter on the way? Why did you put yourself in this situation? These are all things you need to consider.
There’s no nice way of doing this. You have to tell him the truth and hope that he still wants to be with you and raise a baby that is not his. Be prepared for him to dump you and want nothing to do with the baby. That is completely within his rights to do.
You sound like you feel terrible about this. Be honest with him; tell him you love him and want to raise a child with him. Maybe he loves you enough to try to make it work. Maybe he wants a child, and will be willing to overlook the fact that he’s raising the offspring of your one-night stand (or your previous boyfriend, whatever). Honestly, I can’t really see that happening, but you never know.
Have you considered adoption? (I assume getting an abortion is no longer an option?) It doesn’t sound like you’re bringing a child into a healthy environment. Might be something to consider.