No, this is incorrect.
Granted, plenty of farmers leave loaded guns in closets or barns, but these is absolutely no legal exception made for farmers.
By law, they are supposed to store their guns like everyone else does.
To the OP, unless you live in bear country, a light varmint cartridge should be sufficient for your needs.
Off the top of my head, I would list the .22lr .17 HMR, .22 magnum, and .223 rem as ideal rifle cartridges for around the barnyard.
If you're in a situation where you will be shooting predators at longer range (a couple hundred yards out in a pasture), slightly more powerful varmint cartridges like .223 Rem, .243 Win, and .270 might fit the bill. My dad's cartridge of choice for coyotes in the hay field is a 25-06, and it has worked very well for him. It's a bit overkill for shooting raccoons in the chicken coop though.