Martin countered by noting Ireland's contributions to the US.
It was Trump's first Oval Office meeting with a foreign leader since his recent sit-down with Ukrainian President Volodymyr Zelenskyy, which morphed into a shouting match as they jousted over ending Russia's invasion of Ukraine.
Martin, who offered only gentle pushback to some of Trump's comments, is set to return to the White House on Wednesday evening to present Trump with a bowl of shamrocks at an early St Patrick's Day celebration.
The president's banter during the Oval Office meeting also touched on Vice President JD Vance's shamrock-themed socks and Trump nemesis Rosie O'Donnell 's recent move to Ireland.
During the appearance with Martin, Trump repeated his claim that the European Union was created just to stick it to the US.
Asked if Ireland, a member of the European Union, was taking advantage, too, Trump said: "Of course they are. I have great respect for Ireland and what they did and they should have done just what they did, but the United States shouldn't have let it happen."
He was referring to the concentration of US pharmaceutical companies in Ireland, due to the country's tax policies.
"We had stupid leaders. We had leaders that didn't have a clue or let's say they weren't business people, but they didn't have a clue what was happening and all of a sudden Ireland has our pharmaceutical companies," Trump said.
Martin countered the trade relationship is "a two-way street," adding that Ireland's two largest airlines buy more aircraft from Boeing than anyone else outside of America.
More than 700 Irish companies are also based in America, creating thousands of jobs, Martin said.
"That's a little known fact that doesn't turn up in the statistics," he added.
"I understand where you're coming from, fully," Martin told Trump, "but I think it's a relationship that we can develop and that will endure into the future."
When a reporter asked Martin why his country would let O'Donnell move there, Trump jumped at the opening.
"I like that question," the president said, adding that Martin was "better off not knowing" about O'Donnell.
O'Donnell, a comedian and former talk-show host, and Trump have feuded for years. O'Donnell, who is gay, recently announced that she moved to Ireland in January, citing a lack of equal rights in America.