Chancellor in Helmut Schmidt changed six Cabinet members yesterday as part of a major shakeup precipitated in part by bugging and espionage scandals in the West German Defense Ministry.

The changes involve the defense and finance ministries - the two key jobs affecting Bonn's relations with its European allies and the United States.

The chancellor had been planning for some time to make a few Cabinet changes this spring. The double jolt to Defense Minister Georg Leber - the disclosure last December of an East German spying ring operating within his ministry and the additional revelation this week of illegal bugging by military counter intelligence agents - have forced Schmidt to act quickly.

As a result, the reorganization announced yesterday was bigger, less well planned and potentially more troublesome for the chancellor. Bonn will now have leaders generally inexperienced in their new fields in two critical areas - defense and finance - at the same time.

Leber, 57, who has held the defense post for nearly six years and who was forced to offer his resignation following the bugging and espionage disclosures, will be replaced by Hans Apel, 46.

Apel has enjoyed an international reputation as finance minister. He had previously turned down offers to take over the defense post on the grounds that he had no real feel or understanding for the field.

Apel has enjoyed an international will be filled by the current minister for research and technology, Hans Matthoefer.

Although Lebel had become an increasing political liability for Schmidt's Social Democratic Party, mostly because his handling of the two scandals was perceived as inept and embarrassing, he had also become a major figure withing the North Atlantic alliance and reflected West Germany's increasingly important position within NATO.

Leber had clearly become the leader of NATO's European countries. He was strongly pro-American but also had emerged as the European defense chief who could press the United States most effectively to pay more attention to European views.

A former trade unionist and bricklayer, Leber also did not have much experience when he started at the Defense Ministry in 1972. In the years since then, however, West Germany's role has grown and Apel will take office, confronting some tough political and technical issues, including whether to encourage U.S. deployment here of the neutron bomb and cruise missiles.

Like Leber, Apel is also on the conservative wing of the Social Democratic Party and most observers here believe the switch will not cause any basic change in Bonn's attitudes toward defense and NATO. Apel will be the first Bonn defense minister who never wore a German army uniform. In a sense, Apel was drafted for the new spot by Schmidt. In a book he authored two years ago, Apel said his lack of interest in the defense job was not because he opposed NATO or the West German contribution, but because he had never come into contact with people in defense circles and because nothing is more dangerous than the politicians who behaves as though he knows everything about everything."

Apel's departure from finance may be felt more than his arrival at defense. Although Matthoefer has training as an economist, including a two-year stint as a student at the University fo Wisconsin and has served since 1961 on the economic committee of parliament he is moving into the field of international finance at a time when Apel had built up a solid reputation as a defender of Bonn's controversial policies.

One of Schmidt's goals in the more casual reorganization previously planned was to bring younger people into the Cabinet. Thus, while the need to move Apel into Leber's job may be seen as evidence of how thin the to party ranks are for talent. Schmidt did succeed in bringing several new and younger faces to lesser ministries.

Volker Hauff, 37, a deputy to Matthoefer, will succeed his former boss as minister of research and technology. Hauff is a former IBM empolyee and is viewed as a technocrat.

The new education minister is Juergen Schmude, 41. Rainer Offergeld, 40, is the new minister for development aide, replacing Maria Schlei, which means there is now only one woman left in the Cabinet. The Housing Ministry will now be headed by Dieter Haack, 43, who succeeds his former boss Karl Ravens.

The changes unfolded with such speed that Schmude learned of his appointment while on a trip to South Africa.

Schmidt's Social Democrats rule in coalition with the smaller but powerful Free Democratic Party. None of the four cabinet jobs held by the Free Democrats was involved in the reshuffle.