When Reza Samazat came here from Iran 31/2 years ago, he had everything planned: an American high school would prepare him for an American college which in turn would prepare him for an American medical school. There, he would learn to be an open-heart surgeon.

But two weeks ago, the certainty of the 17-year-old high school senior's plans evaporated.As he walked down a dark street near his Gaithersburg home, Samazat encountered four Americans about his own age.

"When they got up to me, they said, 'Are you Iranian?' I said, 'Yeah, what business is it of yours?'"

They jumped him, and the fight lasted five or 10 minutes. Samazat suffered a black eye, a scratched face and a sprained arm.

But the beating's effect went deeper: It left him wondering if an American education is worth the pain of being an Iranian in America.

"Now when I start studying. I start thinking why it's happened and what's going to happen to me." Samazat said this week. "Here in the United States I'm not going to be what I choose, what I make myself. When people look at me, they'll just think I'm an Iranian."

A minute later, he added, "How can I study when people thinks about me this way, when they are angry with me just because I'm Iranian? . . . When I see people showing this feeling, I want to go back to my country."

Jane Ghafory, Samazat's aunt and guardian, said that until the fight, the teen-ager got all As and Bs at American schools. "He used to study all the time," she said, "but now he doesn't care.

"Now for three, four hours at a time he watches TV, but he isn't paying attention. He's just watching. He says, 'I don't know what to do. I'm so confused.' He says he doesn't know whether to stay or go home."

Samazat's fight was only one of several sporadic instances of anti-Iranian violence that have occured around the country since students in Tehran seized the U.S. Embassy there and took Americans hostage.

In the first weeks after the embassy takeover, Iranians in Beverly Hills, Calif., Texas, and Morgantown, W. Va., were beaten, despite President Carter's repeated pleas that Americans restrain their anger.

One South Carolina college tried unsuccesfully to expel all its Iranian students, while a Glendale, Colo., nightclub advertised it would not serve Iranians. On Nov. 27, Attorney General Benjamin R. Civiletti issued a statement calling such discrimination illegal and urging Americans "to honor and respect our laws which protect the rights of persons of Iranian descent as they protect us all."

"I had thought that they might hurt some Iranian people," Samazat said in an interview Monday night. "But I never thought it was going to happen to me. . . Even though I knew I was not going to be free of people, of what they're feeling."

Teen-agers often fight in the malls and subdivisions of the rapidly growing town of Gaithersburg, 20 miles northwest of Washington.

But for Samazat, there was an important difference: the reason that four teen-agers he'd never seen before jumped him. "If they were fighting about soccer or something, that's different, that's not something everybody feels," said Samazat, whose English syntax gets tangled when he tries to express his emotions. "But this happened because I'm Iranian."

Samazat, whose home is in Tehran, came to Gaithersburg High School as a senior this fall after three years at the Pennington School in New Jersey. He had tried of the boarding school regimen there, and wanted to live with the Ghaforys, where he would have more independence.

At Gaithersburg, Samazat found he was one of three Iranians in a student body of about 1,500. He was placed in advanced calculus and physysics courses, studied hard and was doing well.

Then, with the embassy takeover and the constant news stories about Iranian students in Tehran and in the United States, Samazat found himself the object of more and more curious stares, particularly when he and two other Iranians had lunch at one table in the school library.

"The teachers, they have been very kind to me," said Samazat. "The students -- I don't know that many. I usually just study and go home. Some of the students, when I pass by, they say something about 'Iranian' or something, but those in my classes are really friendly."

Other students, he avoids. "Once I talked to one of them and he said, 'I'm pro-shah.' I said, 'Nice to meet you.' He said, 'We don't want you Iranians here, you'd better watch out for yourself.'

"I understand what they're doing," the teen-ager added in a level voice. I "I sometimes have the same feelings. But I don't show my feeling. They do . . . They all blame what's happening in Iran on me."

In part because he distrusts some fellow students, in part out of pride. Samazat followed his uncle Farhad Ghafory's advice and told neither police nor school authorities about the fight until nearly two weeks later.

"I never got beat up before," the 6-foot-tall teen-ager said. "That's why I didn't want to tell them. . . I told some people I was painting and fell. I told others that I had a car accident. I never told anyone what happened."

Despite Samazat's assertions, there was one person who coaxed the story out of him -- a school bus driver named Jennifer McCloud. "He was out for a couple of days, and when I saw him again he was banged up, his arm was in a sling," she recalled.

"I asked him if he was beat up because he was an Iranian. I told him I felt badly if that had happened, becaue I'm an American and I don't feel that way.He was very bitter. He said he was thinking of going home," McClead recalls.

Since then, other things have upset Samazat and the Ghaforys. Farhad Ghafory, 25, works in the accounting division of the National Institutes of Health and is a student at Montgomery Community College. He drives a Volkswagen van that once had a bumper sticker indicating he was from Iran.

As he drove from work to school along Rockville Pike last week, a group of youths in another van began tailing him, got out of their vehicle and approached him when both vans were stopped at a red light. "I just went, and after that I passed three red lights," said Ghafory, who has had open-heart surgery and is afraid that a blow to his chest could seriously injure him.

"If the police stop me, that's good for me," he added.

The Ghaforys also recently moved from a ground-floor apartment near Gaithersburg to one well above ground level. They said students had pelted their window with rocks.

"I read about the Iranian in Colorado who fired a gun at some kids doing that and killed one, shot him in the head," said Ghafory. "I can get mad. I worried I could do that, I could hurt someone."

Ghafory and his nephew, Samazat, are in America legally. While they have no love for the shah, neither has participated in any demonstrations here, they say. "It's not like Reza's radical, demonstrating all the time," said Jane Ghafory, who is an American. "Why should they pick on someone innocent?"

Samazat, like his uncle, had always planned to go back to Iran but wanted to finish his education first. But now, Samazat says, his plans "depend on what happens to other Iranians, and to me. If everyone's leaving, I couldn't stay."

While he tries to make up his mind, Samazat has changed his habits somewhat. He no longer walks home from school and avoids almost all contacts with American students.

"Now I don't talk to anybody," he said.

"Right now, if they gave me two choices, Iran or here, I would take the first. I would take Iran."