This is really a two-part question.
The first part is whether a dog will be legally recognized as a service dog if you train him yourself instead of having him professionally trained. The answer is yes. The Americans with Disabilities Act, a federal law that gives disabled people the right to take service dogs into public places that don’t normally allow pets, makes no requirement that a service dog be professionally trained (as of 2014; this could change in the future). The law does require that a service dog be housebroken, trained to behave appropriately in public and trained to perform tasks that mitigate his owner’s disability, but it doesn’t matter who trains him.
The second part of the question is whether you actually know how to train a service dog and are capable of doing so. Training a service dog is much more complicated than training a pet dog. Unless you have a lot of experience training dogs, including working dogs, you probably don’t have the skills to train your own service dog. It will partly depend on the tasks you need your service dog to perform, but all service dogs must be highly trained in obedience and trained to behave appropriately in public, which means they can’t eat food off the floor, beg for food in a restaurant, sniff food in a grocery store, bark at other dogs in public, solicit attention from other people or do many other things that are pretty natural dog behaviors.
In some cases, your disability may also make it difficult to train your own service dog. For example, I have post-traumatic stress disorder and when I was first considering getting a service dog and thought about trying to train my own, I was informed by an experienced dog trainer that my anxiety in certain situations might teach my dog to be anxious in those situations, which would not be a good thing in a service dog. If you are hearing impaired and want your service dog to respond to certain sounds, it will probably be difficult to train him to do so when you can’t hear the sounds yourself. If you’re not sure if your disability will interfere with training your own service dog, you can consult with an experienced service dog trainer for advice.
For most people, getting a service dog that is already fully trained from a reputable program that trains service dogs is the best option. That way you know you’re getting a trained service dog. If you try to train your own service dog, you risk something not working out somewhere along the way and then you’ve put a lot of time and money into a dog that isn’t going to become a trained service dog. Getting a dog from a program eliminates that risk. If you prefer to train your own service dog, though, and you know how to do it, legally you can do so.