When Marion Barry became mayor he had layers of advisers, people he had met from his days as an activist with the Student Non-Violent Coordinating Committee or Youth Pride Inc., as well as aides from his political life as a school board member and City Council member.

But after nearly four years at the top of the city government, the number of Barry's close advisers has dropped to a few key people.

"I've found out who I can trust, who does their homework before they talk and who just talks," Barry told a reporter during the campaign. "That's part of the learning process."

Now the advisers number barely more than half a dozen:

* Ivanhoe Donaldson, Barry's campaign manager for five successful races and his chief political adviser during his administration, has known Barry for 22 years since they met in SNCC. Donaldson is known as the "deal maker" in the Barry group and is the only person who gets involved in heated, even personal, arguments with Barry without any repercussions.

* D.C. Superior Court Judge Luke C. Moore, who married Barry and his wife Effi, is a trusted adviser on general questions and some legal matters.

* David Eaton, Barry's minister, supported Sterling Tucker in the 1978 mayor's race. But Eaton, now president of the school board, has become a Barry ally of increasing importance.

* Herbert O. Reid, the Charles Hamilton Houston Distinguished Professor of Law at Howard University, is on contract with the city to work 15 hours a week as Barry's legal adviser. But he is also a close Barry confidant.

* Stephen D. Harlan, senior partner in Peat Marwick Mitchel & Co., the accounting firm, and president of the Greater Washington Board of Trade, is another key adviser on whom Barry depended during the city's financial crisis. Harlan's firm has a contract with the city for auditing federal funds for summer jobs.

* Joseph H. Riley, president of the National Savings and Trust Co. bank, is one of Barry's advisers on financial matters, the business community and even on bringing the Soccer Bowl to Washington. According to people close to Barry, Riley has begun to take the place in Barry's cadre formerly held by Joseph Danzansky, the former head of Giant Food and later chairman of the board of the National Bank of Washington, who died in 1979.

* Elijah B. Rogers, Barry's stylish city administrator, has become a close adviser on personal style as well as government decisions. Rogers, like Donaldson, is an aggressive, hardball-style manager, the kind Barry said he feels comfortable having on his side in critical situations.

Barry said he does not talk about the city government with his wife: "When I come home I don't need to talk about problems. Effi will say, what about it? I'll tell her I don't want to talk about it."