It is not illegal to flip off a police officer. The reason is the First Amendment right to free speech, and flipping him off is considered "speech." That said, while not illegal, it's not smart as evidenced by the ticket he gave you. You should hire an attorney in your area to fight this.
I agree. You will want to fight this ticket.
Once you have this ticket resolved, you may want to file a complaint with the police internal affairs department. This cop is abusing his authority by issuing a ticket with bogus charges.
I think you probably don't want to instigate an investigation before the ticket is resolved because this cop has a short fuse and doing so will only encourage the cop to lie to protect his interests.