Pedro Sanjuan began cooking because he was bored with institutional food he had to eat at college.

Michael Berman was just plain hungry.

Both men took up what was to become a lifetime hobby before it became so common for men to be found in the kitchen doing more than standing at the refrigerator door.

While neither Berman nor Sanjuan must cook now, both do and with some frequency.

Berman has cut back drastically, however since he went on a diet last summer. He can't see any point putting temptation inhis way when he is trying to lose more than 100 pounds. So far he has been extremely successful: 80 down and 40 to go. His self-discipline is stronger than it ever has been. Sometimes it even amazes him.

Preparing for a four-course dinner for 10 recently, Berman said he "was able to get through the store without buying anything I wasn't planning to buy, which is amazing. Ordinarily I would buy a a salami and eat it on the way home or peanut butter and squirrel it away."

The control held right through the meal. He ate none of the dessert, creme brulee and had only a small portion of the soup and the main course.

Berman, who is counsel to Vice President Mondale and his deputy chief of staff, didn't get fat because he learned to cook. He learned to cook when he was in college in his home state of Minnesota. His "weird" working hours made it difficult to find places that were open.

But as far back as he can remember, he has always loved to eat at "weird" hours. "Even as a little boy," Berman recalled as he prepared a broccoli pie, "I'd get up before my dad, who got up at 5 o'clock. And I'd eat. Then I'd go back to bed so I wouldn't be punished."

To feed himself when he was in college, he learned simple dishes from his mother, "a superb but very basic cook who served heavy, kosher food," and from an old "Betty Crocker Picture Cookbook" - one of the "treasures," his wife, Carol, noted, he "brought to the marriage." It still sits on the cookbook shelf along with the more advanced selections he has acquired since.

Berman's range grew more extensive when he entered law school. He liked cooking so much he did it for his housemates, along with the dishes.

In the meantime he kept gaining weight. When he came home to visit from law school his mother would grab his cheeks, saying "Oh my God, you're so fat!" Then she would feed him a tremendous dinner.

Friday nights she sent him his laundry box containing "fresh underwear, a whole salami and 15 dozen chocolate chip cookies."

Berman's most "successful" diet in the past culminated in a loss of 50 pounds, just before he married. "It was a condition of getting married," Berman said. But in the first four days of his honeymoon he put on more than 12 pounds. He topped that during the 1963 presidential campaign when he gained 50 to 60 pounds in six weeks.

"I ate full-time, from 7 a.m. to 1 a.m. There was a refrigerator beside my desk and I ate nonstop," Berman said matter-of-factly.

Just as matter-of-factly, he will explain why fear of premature death or difficulty of getting dates have no effect on an obese person's ability to control his eating.

"When you are younger and you're heavy it's very, very unpleasant. Girls won't go out with you. But as you get older and you have any kind of personality and you become very, very involved in things, people are interested in you for the important things. So other than health and being uncomfortable there is no reason to lose weight."

In other words, Berman has no idea why he has stuck with the diet he began July 9, 1977. He thinks it might have to do with keeping regular hours, fewer out of town trips and being less tense. "There's no question that being tense makes you more vulnerable to eating."

Berman must have been quite relaxed at his dinner party: He never nibbled while he was cooking. The dishes he served were a collection of recipes from books and friends and his wife, Carol, whom he considers the better cook.

Berman describes his cooking as "hodgepodge." He is best known for "The Berman Omelette," which is never the same twice. The only consistent ingredient is the chopped-up, grilled salami. Other ingredients which come and go are onions, pimientostuffed green olives, cheese and whatever else might be lying around in the refrigerator. Berman's creme brulee runs a close second in popularity. Without doubt it is one of the richest desserts ever devised.

For this Saturday night dinner, he began cooking Thursday night. He follows a carefully written out schedule, timed to the minute, so that the vegetables which are served with the roast are ready when it is. As efficient as he is about his cooking, his wife noted, as she walked by the kitchen, that the chef was "making a mess." Which brought up the question of who would do the dishes - Berman stayed up until 2 a. m., cleaning up.

Who does the dishes is also a sticky question in Pedro Sanjuan's house.

Just before a recent dinner Sanjuan, who is a resident fellow at the American Enterprise Institute, was asked if he cleaned up after he cooked. His "yes" answer was followed immediately by his wife, Pasty's, "no."

"What do you mean 'no!' Don't you remember two years ago . . ."

Sanjuan defended himself by saying he wasn't a messy cook and cleaned up as he worked. But if Patsy isn't doing the dishes, it's one of their daughter Victoria's chores.

Spanish-born Sanjuan never puts the same ingredients into a dish twice. Consequently he has 42 varieties of gazpacho, one of his favorite creations. There's gazpacho with pork, with sherry, with avocado, bananas and "borschtpacho" which is served with a blob of sour cream and caviar.

Actually he prefers making soups over anything else. "They're more forgiving," he explains, "and if you make a mistake, you can always go on to the main dish."

He's never been able to cook from recipes. "It's not a matter of art, it's rebelliousness." As a result, he admits candidly, "Sometimes the dish is exceptional; other times it's unmentionable."

Even when he isn't officially at work in the kitchen - three or four times a month - he manages to stick his nose into whatever is on the stove. Sanjuan taught his wife to cook when they were married and he's never gotten over it. She does most of the meals now, but he "fixes it up. If I'm not restrained, I will surreptitiously come into the kitchen and add five or six things."

Sanjuan's interest in cooking was almost cut short years ago, when an omelette stuck to the wall.

Shortly after he had mastered the art of making paella, the first dish he tried, he decided he would attempt an omelette. After all, anyone who can make a passable paella should have no trouble with an omelette. But ever the showman, Sanjuan decided to flip the omelette on to a plate, just the way he'd seen professional chefs do it."I didn't realize the plate was a little smaller than the pan and when I flipped it the hot oil dripped down my arm so I flung it the other way and it stuck to the wall."

Others might have retired, but not Sanjuan, whose desire to get away from the institutional food was greater than his fear of being burned.

He composes his culinary creations much the way he paints: with hundreds of images and colors assaulting the senses at once. Both of his talents are attention-getting. His compositions in both fields are distinctive.

At a recent dinner Sanjuan served a sweet and sour chicken with rice ("not minute rice! Why spoil a good meal?") and a salad dressed with olive oil, Madeira, feta cheese and 10 other ingredients. SWEET AND SOUR CHICKEN ZARAUELA (8 to 10 servings) 2 large frying chickens, cut up 3/4 cup olive oil 3 medium onions, sliced 3 green onions, sliced 2 large green peppers, coarsely chopped 4 tomatoes, peeled and coarsely chopped 3 cloves garlic, crushed Salt and pepper to taste 1 teaspoon oregano 1/2 cup green olives 1/2 cup Madeira 1 can (1 pound, 15-ounces) tomatoes 1 teaspoon worcestershire sauce 2 tablespoons apricot preserves 1 pound sliced muschrooms 1 pound medium shrimp, unshelled 1 pound scallops 2 dozen small clams, well-scrubbed.

Heat half the oil in a large skillet. Saute the chicken until golden on both sides. Remove and set aside Saute onions, green onions and green pepper until golden. Add fresh tomatoes. Saute briefly, add remaining oil. Add garlic, salt, pepper, oregano, olives, Madeira and canned tomatoes. Simmer 2 to 3 minutes. Add worcestershire and preserves. Taste for seasoning. Return chicken to pan. Simmer, covered, about 15 minutes or until tender. Add mushrooms and seafoods and continue simmering until shrimp and mushrooms and seafoods and continue simmering until shrimp and mushrooms are barely cooked, 3 to 5 minutes. Adjust seasoning and serve over rice. OIL AND MADEIRA DRESSING (Makes about 1 3/4 cups) 1 cup olive oil 2 teaspoons worcestershire sauce 7 drops hot pepper sauce 2 tablespoons Madeira 1/4 teaspoon salt 1 tablespoon lemon juice 3 tablespoons crumbled feta cheese

1/3 cup wine vinegar 1/2 teaspoon Pickapeppa Sauce 1 clove garlic, crushed 1 teaspoon dried basil 1/4 teaspoon freshly ground black pepper 4 tablespoons tomato juice.

Combine ingredients and mix well. Pour over a salad made of cherry tomatoes, endive, black olives, avocado, leaf lettuce and watercress.

Michael Berman's dinner began with a cream of carrot soup, followed by a salad with beets, hearts of palm and small shrimp. The main course was a filet of beef with bernaise sauce, broccoli pie and wild rice. Creme brulee was served for dessert. CREAM OF CARROT SOUP (6 to 8 servings) 1 pound carrots, scraped and cut into rounds 1 pound potatoes, peeled and cubed 2 tablespoons butter 1/2 cup coarsely chopped onion 6 cups rich chicken broth 2 sprigs fresh thyme or 1/2 teaspoon dried 1 bay leaf 1 cup heavy cream 1/2 teaspoon hot pepper sauce or more to taste 1/2 teaspoon worcestershire sauce 1/2 teaspoon sugar Salt and freshly ground pepper 1 cup cold milk.

Heat butter in heavy pot and add onion. Cook briefly, stirring. Add carrots, potatoes and broth and bring to boil. Add thyme and bay leaf. Bring to a boil and simmer 30 to 40 minutes until carrots and potatoes are tender. Let mixture cool then pass through a food mill or blend in an electric blender. (This may have to be done in two stages.) If soup is to be served hot, bring to a boil and add remaining ingredients. When soup returns to boil, serve at once. If soup is served cold, add remaining ingredients to blended mixture. Stir well and pour into bowl and chill thoroughly.Serve very cold.

If soup is served cold, make 24 to 48 hours in advance and keep cold. It improves with age. BROCCOLI PIE (6 servings) 9 inch baked pie crust 2(10 ounce) packages frozen chopped broccoli, thawed 1 cup mayonnaise 1 cup grated cheddar cheese.

Drain chopped broccoli. Combine mayonnaise and cheese and mix with broccoli. Spoon into pie shell and bake at 350 degrees for 30 minutes. A SALAD (6 to 8 servings) 2 heads Bibb lettuce 1 bunch watercress 1 can (13 to 15 ounces) hearts of palm, drained and sliced 3 tablespoons finely chopped black olives 1/2 cup canned beets, cut into slivers 1/2 pound cooked small shrimp, cut in halves lengthwise DRESSING: 3 tablespoons red wine vinegar 1 teaspoon dry mustard 2/3 cup olive oil Salt and pepper to taste.

Combine dressing ingredients in jar and shake well.Toss lettuce, cress and hearts of palm lightly in dressing. Place on serving plates. In center of each sprinkle olives, beets and shrimp. Dribble on additional dressing. CREME BRULEE (6 to 8 servings) 3 cups heavy cream 6 tablespoons sugar 6 egg yolks 2 teaspoons vanilla 1/2 cup light brown sugar.

Heat cream in top of double boiler over boiling water. Stir in sugar. Beat yolks until light in color. Pour a little of hot cream into yolks, stirring. Then return to hot cream, stirring vigorously. Stir in vanilla and strain into shallow baking dish. Place dish in pan containing 1 inch of hot water. Bake at 300 degrees in a preheated oven for about 35 minutes, or until a knife inserted in the center comes out clean. Do not overbake. Chill thoroughly.

Before serving, cover surface completely and evenly with brown sugar. Set dish on bed of cracked ice. Place under boiler until sugar melts. Watch very carefully or sugar will burn.Chill and serve cold.