Felix, the fussbudget housemate in the popular movie and TV comedy "The Odd Couple," was born out of a real-life situation.

And that, says Danny Simon, a longtime writer for some of radio and television's big hits, is how good comedy is created.

Felix was conceived as the result of a burned pot roast. Danny Simon ought to know. It was his younger brother, Neil, the preeminently successful author of a string of funny stage plays, who wrote "The Odd Couple."

And it was Danny who scorched the beef.

The senior Simon, whose writing credits stretch from early TV's "Your Show of Shows" starring Sid Caesar and Danny Thomas' "Make Room for Daddy" to the more-recent "One Day at a Time" and "Diff'rent Strokes," enjoys talking about his Felix connection. He will be teaching an intensive three-day course on TV comedy writing in September at the University of Maryland, and Felix (portrayed on the TV series by Tony Randall) illustrates a point he hopes to make to aspiring scriptwriters.

Like the situation in "The Odd Couple," Simon had recently separated from his wife and was sharing a home with a Hollywood agent, who also had just returned to bachelorhood. One night they invited friends over for dinner, a big deal for the novice homemakers, and Simon took on the cook's responsibilities.

He botched the job and had to run out to the deli to put something on the table. In the end, dinner was great, but he had to take a good deal of ribbing from the guests. The next morning, still in a bantering mood, Simon's housemate "spoke to me like a husband to a wife.

" 'Sweetheart,' he said, 'that was a lovely dinner last night. What are we going to have tonight?' "

Picking up the joke, Simon answered in kind: "What do you mean cook you dinner? You never take me out to dinner. You never bring me flowers."

As the exchange played on, "We both started laughing. 'Thank God,' we said, 'we're not married and have to put up with that.' "

But then Simon began thinking, suppose that fight between the bachelors was real, that they had the same trouble with each other that they did with their wives? "I knew I had a play," and he shortly had punched out 14 pages of script, which got enthusiastic raves from brother Neil.

But, according to Simon, personal problems stemming from his separation interfered, and he stopped working on the idea. Eventually he turned it over to his brother, who put his own twist to the story and created a show-business classic that went from stage smash, to movie, to long-running TV series.

And a principal reason for its success? It was a story, Simon says, that "we can all relate to."

"Watch any comedy show," he suggests. "The audience laughs at certain jokes and not at others. And this includes Johnny Carson's. The ones they laugh at, they relate to. They don't relate to the ones designed just as jokes."

For several years, Simon has been teaching his comedy course at universities around the country. There is a need for good writers, and he emphasizes the word "good." "Many of my colleagues say, 'You should see the junk we're getting.'

"There is so much bad writing on TV," says Simon, who deplores the network tendency to copy hit shows that may be poorly written. "People watch the shows and think, 'I can write that junk easily.' " And they probably could. "I teach them how to write better. I show them the possibility of what they can do by not following the trend of the network people."

Certain shows stand out for their taste and the obvious talent behind them, and he cites two of his favorites, "M*A*S*H" and "The Mary Tyler Moore Show," the latter "a classic, one of the finest series ever done."

The financial rewards for a scriptwriter can be great. The going rate for a half-hour TV show is currently about $7,500 per script, and with residuals from the reruns "you can hope to make three times that amount."

But good comedy writing is not easy. It probably is a talent you are born with, he says, the talent "to turn words and thoughts around with facility. I can't teach anyone to be funny unless they already are funny. But if I find someone with talent, I can guide them and channel their careers." As an insider in the craft for 35 years, he figures his course puts beginning comedy writers five to 10 years ahead of where they could get learning on their own.

One of his fundamental rules of good scriptwriting is that "those brilliant lines of dialogue" should contribute to building the characters in the play and should not interrupt the progress of the story. "The story emerges from the character." Writers make a mistake, he says, when they toss in a one-liner that gets big laughs but stops the story. "Jokes are the cheapest kind of comedy writing."

It is character development, he insists, that is the real essence of humor--"characters with foibles and idiosyncracies that make the story happen."

A bouyantly cheerful man, Simon is reluctant to reveal his age: "In my mind I'm still 35, but in my body it's a different story." Single since his divorce 22 years ago, he has a son, Michael, 25, who is a Justice Department lawyer in Washington, and a 23-year-old daughter in Los Angeles who is aiming at a career as a designer.

Both he and brother Neil got their show-business start very early. In childhood, their parents' separation created "a painful" family life. But a "native sense of humor" helped ease the days. "We were constantly making jokes."

At about the age of 19, while working at a New York department store, Simon was asked to help with a sketch for an employe show. He enlisted the aid of his brother, a teen-ager 4 1/2 years younger, and their script was a big hit. "From that beginning in our bedroom, we formed a team."

For nine years, from 1947 to 1956, the partnership continued. In the beginning, they wrote monologues for such stand-up comics as Buddy Hackett, Milton Berle, Victor Borge and Phil Silvers. When Danny went West, for a job as messenger with Warner Bros., he got one for Neil. While there, they were picked to write for the Robert Q. Lewis radio show, and they were on their way.

While doing summer stock in the Poconos, they got an offer from the Sid Caesar show and then went on to the Red Buttons, Phil Silvers and Jackie Gleason TV shows. When Neil branched off into play-writing, Danny continued with TV, as well as writing a play himself and directing both on TV and the stage. Simon is particularly proud of his work as headwriter for the "Make Room for Daddy" series. The humor, he believes, holds up well in the reruns.

Another career milestone was the time, at NBC, he hired a 17-year-old writer who showed enormous promise. "His jokes were so original, so distinct, so unique, I hired him immediately." The lad's name was Woody Allen.

"He had been writing jokes for celebrities. I taught him how to write sketches." Allen has acknowledged the debt:

"I've learned a few things on my own and modified a few things he taught me, but everything, unequivocally, that I learned about comedy writing, I learned from Danny Simon." Simon is not shy about publicizing that quote. But of Allen's, and his brother's, subsequent development, he says: "Now I would sit at their feet."

The two brothers remain close. Pops off Simon: "I can borrow $5 or $10 from him anytime." But the relationship is more than that. Danny keeps cropping up as a character in his brother's plays--which illustrates another Simon tip on good writing: Write about something you know.

"By living, by experiencing, the more things you have to write about, the more characters you have to write about."

In Neil Simon's first play, "Come Blow Your Horn," Danny was the inspiration for the older brother, a ladies' man later played by Frank Sinatra in the movie. Is Simon really the ladies' man? "I would like to think so."

Simon says he himself is currently writing a stage play about a brother who writes comedies about his brother.

Though it isn't a requirement, Simon prefers that his students have some writing experience. After the class, "They can go back to their old material and reevaluate it." The class is part lecture and part practice in developing story lines and directing and acting in them.

Simon expects that only about 5 to 10 percent of the students he has taught will go on to become professional comedy writers. But those who do will form a pool of fresh talent he can use for a new cable and pay TV producing company he is organizing.

On the whole, says Simon, Americans as a nationality have a pretty good sense of humor, which is to their--and his--benefit. "I like making people laugh."