If the banking giant obeys a US judge’s order, it risks losing its banking license in Argentina — and the $2 billion it has in local deposits.

But if it follows Argentine law, it risks violating a US federal court order.

Citi finds itself in this precarious position after Manhattan federal court judge Thomas Griesa — who is overseeing the bitter battle between hedge-fund mogul Paul Singer and Argentina over an estimated $3 billion due on bonds defaulted upon in 2001 — ordered the bank not to pay out on some of the country’s locally issued bonds.

Griesa initially exempted Citi’s Argentine law bonds from his sweeping order — stopping payouts to exchange bondholders unless Argentina also paid Singer and other holdout bondholders who demanded full payment.

But Griesa changed his mind last month after learning that some of the bonds for which Citi is custodian were also exchange bonds.

Argentina missed a July 30 deadline to pay the Singer group, throwing it into a technical default.

Citi has until Sept. 30 to fall in line. The bank’s appeal was fast-tracked last week; a hearing is scheduled for Sept. 18.

Obeying Griesa would put the bank in “an untenable and extremely dangerous position — which could lead to consequences as serious as the loss of Citibank Argentina’s banking license and its takeover by the Republic,” Citi lawyer Karen Wagner, of Davis Polk, wrote in a brief filed late Friday with a federal appeals court.

Argentina President Cristina Kirchner has amped up the pressure on Citi.

In a recent speech, Kirchner reminded Citi of its obligations under Argentine law and noted that her government decides who gets banking licenses in the country.

The potential fallout is a major concern for Citi, which has a huge retail banking presence in Argentina — and throughout South America, which is siding with Argentina.

About 18 percent of Citi’s revenues come from Latin America.

Citi was one of the US banks furiously working behind the scenes to cut a deal with Singer and the other so-called holdouts to resolve Argentina’s debt default. But those negotiations broke off last week.