PRODUCER Stuart Ostrow has had two sensational musical hits -- and from such unlikely sources as the Declaration of Independence and the blandest son of Charlemagne -- "1776" and "Pippin."

He also has had two sensational flops, "We Take the Town," which died, Broadway-bound, in Philadelphia, and "Stages," which lasted one New York night.

Now he has a new musical, "Swing," on its way to the Kennedy Center Opera House at a cost, so far, of $1.2 million. It opens here on Thursday.

How does a producer survive such a yo-yo existence?

"Tranquility," responds Ostrow, "is the enemy of success."

At 48, Ostrow looks like a slight, balding Everyman except that where less disciplined Everymen have a paunch, he is trimmed and indented, 20 pounds lighter than when "Pippin" was getting itself together at the Opera House in 1972.

"I thought about what has become 'Swing' for years," says Ostrow, "but it really began to take shape the night of March 19, 1978. That was in New York's Belasco Theater where, with Edgar M. Bronfman, my faithful co-producer, I presented a play called "Stages."

"I was also its author. Nervy of me co-producing my own play? Well, why not? I liked it. I also liked, very much, the staging by Richard Foreman.It got onto the stage exactly as I'd visualized it and I'll never have any complaints about its production.

"But sitting there that opening night I realized it wasn't working with the audience and that it never would. So, during the first act, I decided that the first would also be the last performance of 'Stages.'

"That realization, of course, led me to ask myself, while my brainchild was annoying its audience, 'What am I going to do next?'

"I knew I had to do something. Right away. Along with the announcement the next morning that 'Stages' had closed, I also revealed that my next production would be a musical called 'Swing.'

"When I was a kid in New York -- I went to the High School of Music and Art, the YMHA School of Music, New York University and, finally, Julliard -- I learned to play the clarinet. During summers I played with bands in the Catskills, the Borsht Belt.

"That was the late '40s, early '50s, after the great years of the big bands.

But theirs were the years I was in love with, the sound of those bands.

"And all during those years since I've thought that somehow I'd get back to the kernel of that period, an abstract of what those bands were like, the effects they made, on sound, on people.

"I sat there in the Belasco thinking, well, the time has come. Maybe this is why I've been saving that idea all those years. Musical plays are my passion. Aside from 'Stages' and one other straight play, 'Scratch,' from Benet's 'The Devil and Daniel Webster,' all my productions have been musicals. I'd founded the Stuart Ostrow Foundation for Musical Theater, which now uses the Musical Theater Lab on the Kennedy Center roof, but I couldn't make a living out of that. I'd have to get to work the next morning. I did. I've been doing nothing else but this ever since.

"It took 18 months to be satisfied that we could go into rehearsal. There were endless choices. I found for instance, that there could be little varied drama detailing the lives of the band musicians. I thought of the people who danced to those bands, their stories, what the swing bands had meant in their lives.

"To write the book I got in touch with Conn Fleming of the New Dramatists. We'd done his "The Red Blue-Grass Western Flier' in the Musical Lab and he dug my idea. We've settled on the lives of seven couples as the spine of the story. We begin in 1937 with a dance for Dartmouth College. We end in 1945 when, as we now know, a peculiarly romantic period of American life ended. Along with those bands themselves.

"I also decided that we'd not use arrangements or songs of the period but would have an entirely original score, new music, an abstract of the period sounds. I wanted to be sure we had melody and for the songs I picked two others who had Musical Lab associations, composer Robert Waldman and lyricist Alfred Uhry, who had a very successful collaboration on "The Robber Bridegroom.' Waldman has Jerry Herman's melodic quality.

"For the orchestrations, the right sounds, I chose a man I'd worked with a lot before, Eddie Sauter. The Sauter-Finegan Orchestra, right? He'd worked with me on 'The Apple Tree,' '1776' and 'Scratch,' my second flop.

"Above all, I wanted an association with George I. Simon. He had his own band at Harvard, played drums for Glenn Miller and for 20-odd years was editor of Metronome magazine. He's our associate producer and musical consultant and no one knows more than he about that metier.

"I decided to direct 'Swing' myself, as I had done with 'Here's Love,' because I knew exactly what I wanted. I knew I wanted a bandstand that would glide into different perspectives, angles, for the different episodes. I could see it in my mind. I knew the very guy who could do that, Robin Wagner, whose work you've seen a lot of at Arena Stage and who designed those great train effects for 'On the Twentieth Century.'

"Still thinking visually, the costumes were no problem. Of course the answer would be Patricia Zipprodt, who did them for '1776' and 'Pippin.'

"See how it works? Failures and successes come and go but the fine professionals of theater and music remain -- and when you know who they are, you work out schedules that will fit them into the same place at the same time. yAs I learned from my first time out, that's absotlutely vital.

"Same is true of performers, if you get around enough to be familiar with unfamiliar players. I'm not going to label any of this cast; but though most audiences will never have heard of them, all have had considerable experience despite their youth. I've seen them all, most of them anyway, at one time or another and I've remembered them, felt what they could do.

"In 'We Take the Town' our unknowns included John Cullum and Kathleen Widdoes. In 'The Apple Tree' I had an unknown named Alan Alda. In 'Pippin' we had Ben Vereen and a girl named Jill Clayburgh. In 'Here's Love' we had a minor player named Michael Bennett.

"Our choreographer, a new one, for 'Swing' is Kenneth Rinker, though he has no more of a famous name than 'A Chorus Line's' Bennett did then, but his work is original, not like anyone else's. He comes from Twyla Tharp's and the Joffrey companies.

"Yes, the yo-yo comparison is true enough but the difference is that there is not one yo-yo but scores of them wrapped up in a single effort. Let's just say we're all hoping we're all on an up."

In his hotel room Ostrow looked over at a framed, old-style needlepoint by his wife, Ann. It reads: "Thou Shalt Not Kid Thyself."

Without a hint of a smile, Ostrow says, very softly: "I take it everywhere I go."