Prime Minister Pierre Trudeau and his wife Margaret announced today that they have agreed to separate after more than six years of marriage.

In a terse, four-sentence press release issued by the prime minister's office, the couple put an end to almost three months of speculation about their marital future.

The statement said that Margaret, 28, will abandon the official life with which she felt uncomfortable to pursue an independent career and Trudeau, 57, will retain custody of the couple's three young sons. There was no mention of divorce for the Trudeaus, who are Catholic, in the statement.

The separation brings to an end, at least for now, a storybook marriage that fascinated the Canadian public, thirsty for celebrities.

The statement said:

"Pierre and Margaret Trudeau announce that because of Margaret's wishes they shall begin living separate and apart. Margaret relinquishes all privileges as the wife of the prime minister and wishes to leave the marriage and pursue an independent career.

"Pierre will have custody of their three sons, giving Margaret generous access to them. Pierre accepts Margaret's decision with regret and both pray that their separation will lead to a better relationship between themselves."

Speculation that the marriage was in deep troube began March 5, the couple's sixth anniversary, when Margaret left her home in Ottawa without her husband to attend a concert by the rock group, Rolling Stones, in Toronto.

After the concert, Margaret partied with the Stones group at a luxurious Toronto hotel. She then departed for New York for a week of socializing with the likes of Princess Yasmin Aly Khan, daughter of movie actress Rita Hayworth, and began to attract the attention of the world press.

After a week on the loose, she returned home with a mysterious black-eye to face a privately furious husband.

Her unorthodox behavior prompted rumors of a marriage breakup but the Trudeaus, apparently trying to salvage their relationship, refused to confirm it until yesterday.

The couple first met 10 years ago in Tahiti, where Margaret, still a teenager, was vacationing with her family. Trudeau, a swinging bachelor, was then justice minister of Canada and 29 years her senior.

Trudeau has said of their first meeting: "I thought she had the most extraordinarily beautiful eyes."

After Tahiti, they went their separate ways, Margaret to university in her native province of British Columbia, where she became involved in the fringe of radical student politics, and Pierre to become prime minister.

In 1969, just after Margaret had returned from a trip to Europe and North Africa. Trudeau called her unexpectedly at her home in Vancouver. She recalls having to be coaxed by her mother to go out with him.

"He came just at the right time, when I wanted to talk to someone," Margaret said later.

Margaret then moved ot Ottawa for a government job (some intimates say the real purpose was to be closer to Trudeau). The relationship continued, unknown to the Canadian public.

Suddenly, on March 6, 1971, it was announced that Trudeau had been married the night before to an unknown beauty named Margaret Sinclair, daughter of a former Cabinet minister from Vancouver. She was 22; he was 51.

Trudeau tried desperately to keep his new wife out of the public eye. He told the press repeatedly his private life was none of their business.

But two factors were at work against Trudeau - the overwhelming curiosity of the Canadian public and Margaret's own desire to be more than "a rose in my husband's lapel."

Her emergence began during the 1972 election campaign when she stepped on thepress bus and exclaimed: "Hi! I hear you have more fun back here."

There followed a series of press interviews that showed Margaret was becoming increasingly frustrated with her role and wanted to assert her won identity.

"Pierre doesn't have any expectations of me to always be at his side and I don't have any expectations of him ot always be at mine," she said in a 1973 interview. "We really do our own trips and when we do come together and share and have our marriage thing and be a family it's very beautiful. But it's not all the time."

A year later, during the 1974 election campaign, she sounded a more bitter note: "I fought hard for freedom and I'm not going to be taken over as property."

During that election campaign, Margaret burst forth as never before with a string of speeches in support of her husband, including one in which she said Trudeau "taught me a lot about loving." She was credited in part with Trueau's election victory.

Following the election, however, she had a nervous breakdown and the marriage never seemed the same afterwards. She began taking photography lessons and fancied herself as professional "photo-journalist," although she could not find anyone who would take her work seriously.

Intermittently, she continued in her role as wife of the prime minister, occasionally causing a stir by such antics as singing at a state dinner in Venezuela.

Still, she longed to quit her official role and strike out in her own career. Finally, after her Rolling Stone escapade, she sold some pictures to People Magazine and was assigned to do more. Some say the sensational interview she granted the magazine may have been the real reason for her break.

In the interview she talked at length about her sex life and her desire for freedom. "I am a free spirit that must survive in a free world," she declared. "I've had enough of being public property."

Since the People interview, the Trudeaus mostly have been living apart, with Margaret traveling extensively and returning home only when Pierre was away on official business. The Prime Minister's office could not say where she was today.

There had been speculation that Trudeau would leave politics in order to save his marriage. "If family circumstances made my job impossible, then I suppose I might have to reconsider my job," said Trudeau in an interview last year. But he explained earlier this year that he had been thinking of his children, not Margaret, when he made that statement.