The mayor of Hartford is allowing a barber to continue giving haircuts in a city park even though police and health officials ordered him to leave. A spokeswoman for Mayor Pedro Segarra said he is granting Anthony ‘‘Joe the Barber’’ Cymerys a special dispensation in light of his years of charitable work. The spokeswoman, Maribel La Luz, said Thursday that the city will help Cymerys obtain a state barber’s license if he likes. Cymerys, 82, has been giving free haircuts to the homeless in exchange for hugs for 25 years at Bushnell Park. He says officials confronted him this week and ordered him to leave because he did not have a permit.