* Government split over how to judge vendors' reliability

* Process key to whether Germany opts to keep or ban Huawei

* Merkel keen not to hurt trade ties with China

* Social Democrat partners hawkish towards Beijing

BERLIN, Nov 20 (Reuters) - Germany would need to reach a consensus within government that a telecoms vendor poses a national security threat in order to exclude its equipment from national 5G networks, according to draft legislation reviewed by Reuters on Friday.

The latest version of the IT Security Law follows months of wrangling in Chancellor Angela Merkel's coalition, which has been split over how to craft a political mechanism for judging whether a vendor can be trusted.

How that process works will be crucial in determining whether China's Huawei, the global leader in telecoms networks, can stay in Germany or ends up being banned as it has been by the United States and some of its allies.

The draft seeks to bridge a divide between Merkel, who favours close trade relations with China, and her coalition partners in the Social Democratic Party (SPD) who, led by Foreign Minister Heiko Maas, are hawkish towards Beijing.

An Interior Ministry spokesman said the bill was presented to other departments on Thursday. "The draft implements the results of previous discussions with the ministries and submits new compromise proposals," the spokesman said in response to a request for comment from Reuters.

The SPD had demanded a seat at the table and a Foreign Ministry veto on permitting equipment suppliers to operate in Germany - a deal-breaker for Merkel and her fellow conservative government ministers.

Britain has explicitly declared Huawei persona non grata, requiring mobile operators to phase out its equipment from their networks, while France has settled on an implicit ban, according to sources familiar with the matter.

In Sweden, meanwhile, a legal dispute has escalated after Huawei appealed against a decision to ban it from 5G networks - potentially capable of running smart factories and self-driving cars - on national-security grounds.

CONSENSUS BUT NO VETO

The latest version of the German IT Security Law seeks to finesse matters by creating a standing committee made up of representatives from the Chancellery and the interior, economy and foreign ministries that would work by consensus.

Should the working-level committee fail to reach a common understanding, the matter would be escalated to ministers. If agreement still cannot be reached, it would be referred to the government's disputes resolution procedure.

The tortuous process means that, in Huawei's case, any prospective ban would require both hard evidence and overwhelming political conviction that its equipment poses security risks - as the United States has alleged.

That would represent a tactical victory for Huawei, which denies U.S. allegations that its equipment contains backdoors open to cyper spies and that it is beholden to Beijing.

It would also be good news for Germany's three mobile operators - Deutsche Telekom, Vodafone and Telefonica Deutschland - which rely on Huawei and say that replacing its equipment would cost billions.

A government source said the latest text was expected to go before Merkel's cabinet for approval in December. Media leaks of earlier drafts have, however, derailed coalition negotiations on the legislation. (Writing by Douglas Busvine Editing by Alex Richardson and Mark Heinrich)