NEW YORK (AP) _ Campeau Corp., which attempted a hostile takeover of Allied Stores Corp., has reached agreement on a $3.46 billion merger with the retail giant, the companies said in a joint statement Sunday.

As part of the merger, Campeau agreed to allow Allied management to continue in office for at least three years and to ask Allied directors to join the Campeau board of directors.

Allied Chairman Thomas M. Macioce said, ''We will not face the problem of a new management coming in.''

In a telephone interview, he called that part of the agreement ''a real plus,'' adding, ''We'll be in a position to continue what our program has been - to continue to expand our specialty store business.''

Macioce will become Campeau chairman upon the merger's completion.

He said there would be no divestment of Allied holdings without consultation of Allied management for three years after the merger.

''Through this merger agreement, we have been able to provide our shareholders with meaningful enhanced value on their investment,'' he said in the joint statement.

Under the agreement, Edward J. DeBartolo Sr., the nation's largest shopping mall developer, and Sacramento, Calif., investor Paul A. Bilzerian are giving up their friendly takeover bid for Allied.

Allied shareholders will receive $69 a share in cash and securities. If the merger is not completed by Jan. 31, the cash portion of the consideration for each share will increase by 11.5 percent on $69.

Allied stock closed Friday at $66.12 1/2 on the New York Stock Exchange.

The New York-based Allied, which owns 684 stores, including the Bonwit Teller and Brooks Brothers chains, had $1.59 million, or $3.21 a share, earnings on sales of $4.14 billion in fiscal 1985.

Campeau, a Toronto-based commercial real estate concern, had total assets of $2.4 billion Canadian as of Dec. 31, 1985, with revenues of $213.5 million Canadian from its real estate operations.

The agreement followed a battle between the two firms that began in September, when Campeau, which held 4 percent of Allied stock, attempted a friendly takeover with a tender offer of $66 a share.

Allied's board rejected the bid, and later agreed to a friendly takeover by DeBartolo and Bilzerian, who had formed ASC Acquisition Corp. to acquire Allied and were offering $67 a share.

However, DeBartolo's bid was thrown into jeopardy when Campeau's attempt turned hostile and the real estate concern upped its holdings in Allied by acquiring 25.8 million shares or 48 percent.

Campeau and Allied agreed that the Youngstown, Ohio-based Edward J. DeBartolo Corp. will have rights of first refusal on certain Allied operations and properties. The DeBartolo Corp. also will be a consultant and joint venture partner in Allied's participation in new shopping centers.

Ten percent of Allied's department stores are on DeBartolo properties, the statement said.

DeBartolo said in the Allied-Campeau statement that his company was ''pleased that this merger will not only preserve and enhance our existing relationship with Allied but provides an entirely new opportunity to expand that relationship through our agreed-upon ventures with the Campeau Corp.''

All litigation between Campeau and Allied was ended under the merger agreement.

On Oct. 24, a federal judge had issued a termporary restraining order against Campeau, halting its Allied stock purchase. That order was partially lifted last week, allowing the purchase to go through, and a hearing was set for Tuesday on an Allied request for an injunction against Campeau.