What kind of doctor specializes in sleep apnea if you are in a small town far from specialists?

Primary care. Talk to your primary care physician, he will help you find the right resources. Most hospitals have a sleep testing facility and can point you in the right direction.
Try Pulmonary or ENT. Often you may find a lung specialist or ear-nose-and-throat specialist who can give input and help with making that diagnosis if your family doctor is not comfortable doing so. The condition is very common though, and mot doctors should be able to order the appropriate tests and guide you in treatment. Ent doctors can sometimes perform corrective surgery.
Some ENTs. or pulmonologists may specialize in this. Your insurance company or PCP may be able to give you guidance on where to go.
A sleep specialist. You may have to drive as sleep physicians are trained to treat these disorders. A family doctor will have knowledge but not specifically about the intricacies.
Talk to your Doctor. You can start by talking with your Primary Care about getting tested for possible Sleep Apnea. Usually a hospital will have the ability to do the testing and can get you set up with a physician for follow-up.