Carpenter bees prefer softwood species such as cedar, redwood, and pine. White pine is their absolute favorite. They do not prefer hardwoods. Unfortunately, most timber in the U.S. is pine, but if you can build with hardwood, do it.
Barring this, painting or staining the wood deters carpenter bees somewhat, though a desperate, determined bee will find a way. If you do not want to use either of these chemicals, I have personally had success with using almond oil to coat the wood. Sweet almond oil is naturally repugnant to carpenter bees and some other insects, and will repel all but desperate bees. Beware, however, if you are in an area that has woodpeckers.
Ants and other insects will get trapped in the oil, and you will find woodpeckers taking advantage of this and poking little dents in your wood. The standard sweet almond oil you find at the drugstore for use on the body works fine.
If none of this works, you will need to a: identify the female carpenter bees and eliminate them, or b: cut off the nesting site, as carpenter bees return year after year to the same site. The best method to identify the female is to watch who is boring. Female carpenter bees bore the holes. Male carpenter bees are the aggressive ones that dive bomb you. But they are full of bluster, and cannot sting. Female carpenter bees can sting, but are rarely aggressive. Kill the ones boring the holes using a wooden plank, a tennis racket, etc. and you prevent them from nesting. If a hole is already established, take a small wad of steel wool, shove it in the hole, followed by wood glue, and a 1-inch long piece cut from a 1/2 inch wooden dowel. The steel wool prevents any hatching bees from being able to escape the hole, or the mother from being able to bore back in. If you just cover the hole with wood filler or a dowel, they can cut right back through it. Dowels are cut to 1 inch because this is the depth the bee typically bores a hole before branching off to the side.
With all this in mind, it is important to note that even though the site of a wooden surface riddled with holes can be alarming, it would take many years of prolonged, intense carpenter bee infestation to cause structural damage to most structures. If you only have one or two carpenter bees buzzing around a fairly large house, there's probably no need to worry. Also, remember these are important,
native pollinators.