It all started out normally enough when M.K. Ofosu-Appiah, 28, a Liberian graduate student at Johns Hopkins University here, met Delores Buchanan, an American, and married her in March 1984.

He found her "intelligent and attractive," he said. He also gained permanent resident status in the United States by virtue of his marriage to an American citizen.

But Ofosu-Appiah testified in Baltimore City Circuit Court today that the marriage soon turned into a nightmare -- and his resident status was jeopardized -- when he dis-covered that Delores Buchanan had been born a male but had undergone a sex change operation before their marriage. Further, he said that she had always spurned his advances.

After a brief court hearing at which Buchanan, 39, failed to appear, Judge Hilary Caplan ordered the marriage annulled. "Absent evidence to the contrary," Caplan said, "I must conclude that Delores Buchanan was a male at birth." Marriages between two men or between two women are prohibited under Maryland law.

Caplan, clearly eager to grapple with the trickier issue of whether Maryland law would permit a man to marry another man who has undergone sexual conversion by surgery, said he could not reach the issue because Buchanan had failed to appear at the hearing and he had no documented evidence confirming her claim that she had a sex change operation some years ago.

Ofosu-Appiah, a slender goateed man who, according to court records, is the son of a tribal king in the west African country of Liberia, smiled with relief after the hearing and shook the hand of his attorney, Samuel Blibaum. But the prince now faces possible deportation because of the dissolved marriage.

"He could go back and then apply for reentry," Blibaum said. Also, the attorney said, Ofosu-Appiah "is dating somebody else now" and could get married again.

Ofosu-Appiah declined to discuss his plans. Charles M. Honeyman, another attorney representing the prince in his case before the U.S. Immigration and Naturalization Service, also would not discuss details, but said there are "circumstances in his life that should relegitimize his residence status" so that he can remain in the United States.

At today's hearing, Ofosu-Appiah said he met Buchanan shortly after coming to this country to study business management at Johns Hopkins. He said he conducted a prudish, arms-length courtship, in accordance with the custom of his country, before marrying her. He denied in his testimoy that his marriage was an effort to secure resident status.

After the wedding, he said, she brushed aside his sexual advances with various "excuses," and he never saw her disrobe.

When she went to bed, he said, "she wore a very long robe that was not transparent."

When after some months he began to suspect she might be a lesbian or transvestite male, he said, he checked a copy of her birth certificate, which was introduced as evidence at the hearing, and found that the word "female" had been superimposed over the word "male" and that her name had been changed from John to Delores. When he confronted her, she said she had undergone surgical conversion to become a female, he said.

Blibaum said attempts to verify the sex change through hospital records were unsuccessful.