* President tasks Conte with forming a 5-Star/PD cabinet
* Conte headed the previous 5-Star/League coalition
* 5-Star online referendum could sink the proposed pact
* Markets rally on hopes of new government (Updates with Conte reappointed to form a government)
ROME, Aug 29 (Reuters) - Italy's head of state gave two former political enemies the chance to form a new government on Thursday, capping an extraordinary three weeks that could mark a turning point in its frayed relations with the European Union.
President Sergio Mattarella handed Giuseppe Conte a fresh mandate to put together a new coalition of the 5-Star Movement and opposition Democratic Party (PD), a presidential official said.
Conte resigned last week after the far-right League party withdrew from its coalition with the 5-Star, forcing Mattarella to consult with all Italy's main political parties to try to find a way out of the political crisis.
Both 5-Star and the PD told the president on Wednesday they were willing to lay aside their long-standing animosity and try to form an administration with Conte, an academic considered close to 5-Star, at the helm.
The two sides still need to agree on a shared policy platform and team of ministers, but 5-Star chief Luigi Di Maio and his PD counterpart Nicola Zingaretti said they had pledged to find common ground for the good of the country.
"We love Italy and we consider it worthwhile to try this experience," Zingaretti told reporters on Wednesday. Speaking shortly afterwards, Di Maio said: "We made commitments to the Italians...and come what may we want to fulfill them."
In an early, basic draft of a coalition policy platform, the two sides would ask the EU for flexibility on the 2020 budget deficit to "reinforce social cohesion" in the country, financial daily Il Sole 24 Ore said on Thursday.
The EU imposes budget rules on member states with the aim of ensuring financial stability in the bloc. It has had a testy relationship with Rome under the outgoing administration, with League leader Matteo Salvini blaming the EU rules for impoverishing Italians.
The prospect of a new administration led by Conte has buoyed markets, which are betting that Italy will get a fiscally prudent government that will avoid confrontation with Europe.
Before Mattarella mandated Conte to form a new administration Italian government bonds had maintained their recent rally into Thursday. The yield on 10-year debt traded at around an all-time low it touched the previous day, and . the spread between Italian and German 10-year debt was at 166 basis points, it's tightest since May 2018.
Italian stocks rose 1.33% to hit their highest level since Aug. 2
(Writing by Crispian Balmer; additional reporting by Valentina Consiglio, Gavin Jones in Rome; Editing by Jon Boyle)