Federal law makes it a serious crime for a person to impersonate an officer or employee of the United States, under 18 U.S.C. § 912:
Whoever falsely assumes or pretends to be an officer or employee acting under the authority of the United States or any department, agency or officer thereof, and acts as such, or in such pretended character demands or obtains any money, paper, document, or thing of value, shall be fined under this title or imprisoned not more than three years, or both.
Under 18 U.S.C § 913 it is also a separate crime to make a search or arrest while impersonating an officer or agent of the United States:
Whoever falsely represents himself to be an officer, agent, or employee of the United States, and in such assumed character arrests or detains any person or in any manner searches the person, buildings, or other property of any person, shall be fined under this title or imprisoned not more than three years, or both.
Those who are accused of a crime in connection with impersonating a Federal employee or agent can be imprisoned for up to 3 years. As such, it is important to take any such charge seriously, and seek an attorney at once.