One of the mysteries of the AIDS epidemic is that a small number of female prostitutes in Africa seem resistant to the virus that causes the disease even though they often have sex with infected men.

Despite an intensive search for immunologic explanations, none have been found.

Now an even more baffling finding has turned up in a study of 1,900 prostitutes in Nairobi, Kenya. Four of them became infected with H.I.V., the virus that causes AIDS, but only after they stopped working as prostitutes or took breaks of two months or more, leaders of the study reported at the Seventh Conference on Retroviruses and Opportunistic Infections, which ended here today.

Scientists cannot explain this seeming paradox but say the answer could affect development of an AIDS vaccine.

The prostitutes work in a Nairobi slum. In 1984, researchers from the University of Nairobi and the University of Manitoba in Winnipeg, Canada, began to study and treat the women's sexually transmitted diseases.