Mr. Rogers is believed to be the first foreign guest on the Soviet program, and is certainly the first American invited into the world of Khryusha the piglet and Styopa the rabbit, puppets who are regular visitors in millions of Russian homes every evening.

The 15-minute Soviet program, which has been aired for 23 years, is a mixture of homey morals about manners and kindness, and creative animation involving everything from clay figurines to textured puppets that live out Russian fairy tales, old and new.

''At first I thought this was a lark, I thought the exchange would never happen,'' Mr. Rogers said this weekend as Soviet and American sound and light technicians, speaking mostly with hand gestures, got Gostelradio's Studio No. 2 ready for filming. ''I think, with a lot of other things, this shows the increasing good will.'' Mr. McFeely's Idea

The idea for the exchange was born when Mr. Rogers's public relations consultant, David Newell - the speedy deliveryman Mr. McFeely to the show's viewers - saw an ABC broadcast about Soviet television and heard Ted Koppel compare ''Spokoinoi Nochi'' with ''Mister Rogers' Neighborhood.''

''He came up to me the next day and said, 'Why don't we try to effect an exchange?' '' Mr. Rogers said.