JOHANNESBURG, Sept 21 (Reuters) - Investment holding firm Oakbay, owned by the Gupta family that has faced allegations of using ties with South Africa’s president to wield undue influence, lost a court bid on Thursday to stop Bank of Baroda from closing its accounts.

The ruling could allow the South African unit of Bank of Baroda to join several other firms that have distanced themselves from a scandal involving business friends of President Jacob Zuma.

The Gupta family is accused by a public anti-corruption watchdog and senior members of the ruling African National Congress party of using friendship with Zuma to exert undue influence and win business.

Zuma and the Guptas deny any wrongdoing. The Guptas and their companies have not been charged with any crime and they say they are the victims of a politically motivated witch-hunt.

Philips Daniels, a lawyer for Oakbay, confirmed on Thursday that his client’s application to stop Bank of Baroda from closing its accounts at the end of September had been rejected.

The judgment leaves Oakbay, which has interests in mining, hotels, computers and engineering and employs some 7,500 people, with less than two weeks to find an alternative bank account.

Between December 2015 and April last year, all four major South African banks - Standard Bank, Nedbank, Barclays Africa and FirstRand - terminated the accounts of companies controlled by the Guptas, citing reputational risk.

Global accounting firm KPMG has also cut links with Oakbay. KPMG’s work with Oakbay, which it said its own inquiry showed had fallen “considerably short” of its standards, cost it at least three clients and several large companies are reviewing whether to continue using the Dutch-based auditing firm.

The Gupta brothers - Ajay, Atul and Rajesh - moved to South Africa from India at the end of apartheid in the early 1990s and built a business empire spanning technology, media and mining.