The Justice Department is investigating UK banking giant Barclays and the US Postal Service over an alleged attempt to unmask a whistleblower, The Post has learned.

Barclays, at the request of Chief Executive Jes Staley, reached out to postal inspectors after its board received two letters mailed from an anonymous employee complaining about the hiring of a mid-level executive, according to a source familiar with the probe.

Justice Department investigators are trying to determine whether officials at Barclays or USPS inspectors may have violated civil Dodd-Frank whistleblower protections or even criminal law by attempting to unmask the employee, according to the source.

It’s not yet clear if the USPS acted on the bank’s request. Barclays said it never learned the identity of the whistleblower.

While the civil protections of Dodd-Frank are clear, one expert in whistleblower cases said the repercussions could be more severe.

It’s possible that anyone in the US government who aided the bank in unmasking the whistleblower could face criminal charges, according to Jordan Thomas, chair of the whistleblower committee at New York law firm Labaton Sucharow.

“Under what circumstances do government agencies work for corporations?” Thomas asked.

Justice Department investigators are joining the UK’s Financial Conduct Authority and New York’s Department of Financial Services to investigate the bank, and are investigating whether a US government employee had violated Section 922 of Dodd-Frank by helping Barclays unmask the whistleblower, sources said.

Spokespeople for the DOJ and the USPS didn’t return requests for comment. Kerrie Cohen, a Barclays spokeswoman, declined comment.

The bank announced Monday that Staley had asked the bank’s internal security team in June to find out who sent two letters to the board that were critical of the hiring of Tim Main to run Barclays’ financial institutions group, according to a source familiar with the investigation.

The anonymous letters had raised issues about “Staley’s knowledge of and role in dealing with” personal issues at Main’s previous employer, “and the appropriateness of the recruitment process followed on this occasion by Barclays,” the bank said.

Main had previously worked for New York investment bank Evercore.

Staley’s request in July for the bank’s security team to try to learn the ID of the letter writer was his second attempt to unmask the whistleblower. The CEO had asked first in June — but was rebuffed.

Those internal security personnel reached out to officials at the USPS in order to track where the letters had originated, the source said.

It’s not clear whom the Barclays security personnel reached out to. The USPS’ Inspection Service bills itself as “America’s oldest federal law enforcement agency.”

Dodd-Frank mandates that whistleblowers’ anonymity be protected. There is a similar civil protection in the UK.

The bank said the “author of the letter was not identified.”

Staley, who’s had the top position at Barclays since 2015, had told his board earlier this year that he thought it was legal to unmask a whistleblower.

“I am personally very disappointed and apologetic that this situation has occurred, particularly as we strive to operate to the highest possible ethical standards,” the bank’s chairman, John McFarlane, said in a statement.

The bank made a “very significant” change to how much Staley was going to get for his bonus this year, the bank said in a statement.

“I have apologized to the Barclays board, and accepted its conclusion that my personal actions in this matter were errors on my part,” said Staley, a former JPMorgan banker.

The bank said that, despite Staley’s behavior, they support him staying on as CEO.

“Unfortunately, you regularly see leaders within corporate America wanting to hunt down whistleblowers within their organization,” according to Thomas.