There is no federal law requiring any law enforcement anywhere to have to identify themselves or give their badge number when asked, whether in an interaction with them or not. Municipalities may have a policy that requires officers to give their name when asked.