Theresa May has said there is “goodwill on all sides” to resolve any border problems between Ireland and Northern Ireland thrown up by Brexit.

During a visit to an agricultural show in Northern Ireland, the prime minister also said she was “personally engaged” in resolving the current power-sharing deadlock in Belfast.

She said she hoped an agreement would be reached by the deadline shortly after the UK’s general election on 8 June.

May told broadcasters: “We have got to make sure we do resolve the issue of the border between Northern Ireland and the Republic of Ireland. I’m very clear that we want to see no return to the borders of the past, no hard border, but I’m clear that we need to see as seamless and frictionless a border as possible.”

She said the issue had been set out in her article 50 letter triggering the start of Brexit negotiations and detailed in the response from Brussels. She added: “There’s goodwill on all sides.”

May made the comments as she toured the Balmoral show in Lisburn where she attracted a crowd as she stopped to talk to stallholders including members of the Women’s Institute dressed up as nursery rhyme characters.

As she walked past the parade ring, May bumped into the DUP leader, Arlene Foster, and her son and stopped for a quick chat.

The prime minister was later asked about criticism that she had not been involved enough in resolving the Stormont political crisis, and she pointed to meetings she held before Easter with Foster and Sinn Féin’s Michelle O’Neill.

“I have been personally engaged. I have had contact with both Michelle and Arlene,” she said. “But what is important if we are going to see what we all want, which is a return to a strong and stable devolved administration here in Northern Ireland, is that the parties here in Northern Ireland come together and agree to an agreement that can enable that devolved administration to be established.”

Sinn Féin’s Brexit spokesman, John O’Dowd, said: “The arrogance of Theresa May is astounding, visiting the Balmoral show while her Tory cabinet is planning to impose Brexit on the north which will be disastrous for our farming and agrifood industries.

“Since taking office, Theresa May has visited the north once, taken one media question and then departed. Now that Ms May has ticked a box and visited the north one more time for the election, she will jet off home and continue to ignore the democratic wishes of the people here.

“This is a British prime minister whose Tory party received just 0.3% of the vote in the last assembly election in the north. Her politics have been rejected both at the ballot box and in a referendum where the people of the north voted to remain within the EU.”