Speaker Jim Wright was assured of re-election to his post despite an inquiry into allegations of unethical behavior, as both parties in the House gathered Monday to select their leadership teams for the 101st Congress.

Democrats and Republicans were caucusing to organize for the new session that begins in January, and both Wright, D-Texas, and minority leader Bob Michel, R-Ill., were certain to be re-elected for two more years.Majority Leader Thomas S. Foley, D-Wash., and Majority Whip Tony Coelho, D-Calif., who were first elected to those posts two years ago along with Wright's ascendency, are returning to face a new president together.

"The team is together," said Coelho.

To start 1987, the new leaders came forward with an aggressive agenda to counter the Reagan administration. This time they are laying back to give George Bush a chance to offer his own plans.

"We welcome his getting on the wagon" on issues such as child care and the environment, "and we intend to see what he wants to do," Coelho said.

Wright's first two-year term as speaker was clouded because of a House Ethics Committee probe into allegedly improper financial dealings.

On the Republican side, Michel, the minority leader for eight years, served with Bush in the House, and the new president will have another ally in Rep. Dick Cheney, R-Wyo., moves up a rung on the GOP ladder to fill the slot of minority whip. That No. 2 slot is being vacated by Trent Lott of Mississippi, who was elected to the Senate.

The principal contested races on each side were for the largely ceremonial tasks of presiding over party meetings, and those contests could put women and a black into their highest-ever positions in congressional leadership.

Rep. William H. Gray III, the chairman of the House Budget Committee, is widely considered the favorite to become to the new Democratic caucus chairman. If he wins over Mary Rose Oakar, D-Ohio, who has been vice chairman of the caucus, and Mike Synar, D-Okla., he would be the first black to climb that high in the leadership structure, according to House historians.