Whether it is to complain about or commend a police officers actions, sometimes finding out a badge number is necessary. This is public information but you will need a name in order to find out the badge number of a specific officer. You can find this out through the law enforcement agency that particular officer is a member of.
Contact the local law enforcement agency directly. By either going into the main police station or calling in you can request an officer's badge number by providing his name. This is public information, so the receptionist must disclose the number promptly. If you do not have the officer's name there is very little they can do for identification of the officer to provide the badge number. If there was an incident with the officer that you'd like to press charges on, a transcript of dispatches may be provided.
Search the law enforcement agencies employment records. By going to the town's archives or by searching at the police headquarters' archives you can find all officers employed and their badge numbers. Again, this will require a name in order to correlate with a number.
Ask the officer directly. Police are required by law to provide identification that shows they are in fact officers. Any type of identification would have their badge number on it. If they refuse to provide it they are in violation of the law.