Sean Thompson, 32, explains why he threw a pie at Sacramento Mayor Kevin Johnson.

The alleged attack on Johnson unfolded around 6:45 p.m. at Sacramento Charter High School, which Johnson attended when it was a traditional school and later helped transform into an independent charter school last decade.

The Seeds of HOPE Harvest Dinner, a fundraiser in the high school’s garden, highlights local produce and involves students in preparing the meal. Chef Patrick Mulvaney, a leader in the city’s farm-to-fork movement, said he was at the dinner but didn’t see the altercation. Other notable chefs at the event included Billy Zoellin of Bacon and Butter and Kurt Spataro of Paragary’s.

Johnson was traveling Thursday to Washington, D.C., for the opening of the National Museum of African American History and Culture. Mayor-elect Darrell Steinberg, who was attending a news conference at the Crest Theatre on Thursday morning, said he doesn’t know what he would do if the same thing happened to him.

As a public official, “you sign up for a lot, but you don’t sign up for this,” Steinberg said. “It’s a pretty scary thing to see someone coming at you.”

In a Facebook post on Friday, a person who appears to be Thompson wrote: “Mayor Kevin Johnson is a retired basketball player, and all he’s done for our community is rub elbows with the upper class, and build an expensive arena on the taxpayers dime. Also, she (sic) has some questionable sexual exploits.”

In a video on the website of Sac City Express, the student newspaper at Sacramento City College, Thompson said he had been arrested three times as a member of the Occupy movement, a protest against social inequality that began about 2011. Jail records indicate that a charge of failure to disperse was dismissed against Thompson.

Thompson was among the first released from jail in October 2011 after Occupy arrests. “It was stupid, it was unnecessary,” he said of the arrests. “Was I treated well? Not at all.”

He also spoke about Johnson: “He spoke out about us twice, saying he supports police,” in enforcing a nighttime anti-camping ordinance for city parks, Thompson said.

Andrew Blaskovich, owner of the Drewski’s food truck, said he hired Thompson last year to draw a sidewalk panel at the annual Chalk It Up event in Fremont Park. Blaskovich’s dog, Rex, had been killed a few weeks earlier during a break-in at his home. Thompson drew a picture of the dog with the phrases: “RIP Rex” and “JusticeForRex.”

“He didn’t seem like he would hurt a fly,” Blaskovich said of Thompson. “When I told him my dog had been killed, he turned white and said it was the worst thing he’d ever heard. The guy was super cool, super chill. I didn’t think he would put a pie in the puss of our mayor.”

Bill Lindelof and Richard Chang contributed to this report. Ryan Lillis: 916-321-1085, @Ryan_Lillis