So, if you aren't currently renting to anyone, and for two years and claiming the income on your taxes, no. They won't let you use it.
Your example of what it is you can do with a duplex isn't the same as what it is you state you are planning to do so, it's not really an apples to apples comparison.
Speak to a local licensed mortgage professional about this.
It might be wise to consider -- if it comes down to the only way you can feel financially comfortable buying a home is to rent out a room or two -- that maybe it's not time to buy a home. It's hard enough to get used to home ownership, maintenance issues and all that comes with owning a home, for a person who is financially stable and can easily afford it. It's much harder issue if it's a struggle.
Your best bet is to talk directly to a mortgage broker. You can call Dan Tharp from Comstock Mortgage at 916.257.1470, because he's the guy I would call for a mortgage. Maybe you can qualify without roommates because the underwriter won't use that potential income.