The attack took place shortly before 4 p.m. at the municipal office in Stara Kornica, about 150 east of Warsaw.
The victim, Mayor Beata Jerzman, was airlifted to hospital with injuries, private broadcaster TVN24 reported.
"She was transported by air ambulance to hospital," police spokeswoman Weronika Wujek said, adding that the suspect was in custody and that proceedings were underway under the supervision of a prosecutor.
Jerzman was taken to a hospital in the city of Siedlce, where her condition was no longer considered life-threatening, according to TVN24.
Police said the suspect is an employee of the municipal office. He allegedly waited for Jerzman in a corridor and attacked her after a meeting with residents.
According to investigators, the man was carrying two knives and targeted the victim's neck, chest and kidney area. After stabbing the mayor, he knocked her to the ground and continued the assault.
He is expected to face charges on Thursday at the district prosecutor's office in Siedlce.
Local media reported that office staff subdued the attacker before police arrived.