Authorities threw the book at a career anarchist who splashed red paint on Police Commissioner Bill Bratton during a Ferguson-linked march through Times Square on Monday night — and the top cop said he hopes the agitator’s next artwork comes behind bars.

“He is a professional agitator that I hope will soon be a professional resident of Riker’s Island if we have a successful prosecution for the assaults on myself and the eight officers,” Bratton said of Diego Ibañez, 26.

Bratton had just finished a quiet meal at a restaurant near the mayhem when he stepped outside to inspect his officers’ response, sources said. Almost immediately, he was then splashed in the head and face with the paint bomb on a pedestrian plaza between West 45th and 47th streets near the TKTS booth.

Bratton’s hair wound up smeared with blood-like goo and his blue suit was ruined, but he had a sense of humor about it.

“My wife’s been complaining about my gray hairs and has asked me to darken them a little bit,” he quipped. “But bright red is not quite what I’m looking at.”

A member of Bratton’s security detail bore the brunt of the vegetable-based imitation blood at around 9:30 p.m., and cops immediately slammed Ibañez to the ground.

The 26-year-old — who was a major figure in the Occupy Wall Street protests, having run the kitchen in Zuccotti Park — was charged with assault, obstructing governmental administration, disorderly conduct, harassment, reckless endangerment and criminal mischief. He was awaiting arraignment Tuesday night.

Police sources called him an “activist for hire” with a long arrest record.

Ibañez’s pals said he works a day job as an after-school teacher for children and that he’s especially interested in topics such as immigrant rights.

A native of Bolivia, he spent most of his life in Utah, where he went to college at Utah Valley University.

“This is not the first time he has been arrested protesting,” said Juan Ruiz, who lives near Ibañez’s home in the rectory of St. Jacobi Lutheran Church in Brooklyn. He watched as his friend was handcuffed on Monday night.

Bratton, meanwhile, said it was his suit that suffered the most from Ibañez’s stunt.

“It’s not the cleanest this morning,” Bratton said of his outfit, adding he’s not sure if the ensemble is salvageable. “I’m picking up three new ones tomorrow so I’ll be ahead of the game in any event.”

The roughly 1,000 protesters who marched through the city Monday, choking traffic and blocking three bridges for a time, had no permit, police officials said. Permits are required for any demonstration or rally on city streets. But the NYPD says it has discretion based on the situation.

On Tuesday, Bratton said cops allowed the Monday night march from Union Square up Seventh Avenue to give demonstrators “breathing room.”

“As long as they remain non-violent, as long as they don’t engage in issues that cause fear or create vandalism, we will work with them to allow them to demonstrate,” Bratton said.

Additional reporting by Larry Celona and Aaron Short