Becoming the Reagan administration's ambassador to the Organization of American States must have seemed irresistible to the redoubtable J. William Middendorf. Until then, the marriage of his governmental and composing careers had proceeded on a one-at-a-time basis.

He would be assigned to a country, like the Netherlands, and then he would compose a work, like the "Holland Symphony."

But as ambassador to the 28-member OAS he would have all those countries to compose about. Only the United Nations could be better.

He has already written works for Mexico, Belize, Trinidad, the Bahamas and Venezuela.

Last night he got around to Brazil, in "A Brazilian Triptych," a modest but pleasant little suite that was given its world premiere by the New World Chamber Players in the Inter-American Music Festival.

Nobody's pretending the ambassador is the new Stravinsky, least of all Middendorf himself. The "Triptych" is about 12 minutes long, in three easy movements. As played by last night's nine players--strings, winds, piano and tympani under Stephen R. Kleiman--it sounded almost like cabaret music, with a touch of samba and bossa nova.

Middendorf, who also is a former secretary of the Navy, does have a way with tunes. They are individual, with an exotic touch to some. They are also eclectic; the melody near the end of the second movement seems to come right out of Liszt's plangent concert etude, "Un Sospiro."

There were other events at the concert, which was held at the National Academy of Sciences. The scores of Mexican composer Sylvestre Revueltas' "Planos" failed to materialize, so his short, snappy "Ocho por Radio" was substituted.

Two works followed, one of them mostly electronic and the other music of chance, which tended to wallow without direction in wild sonorities just for the sake of sound. The better work was the electronic one, Brazilian composer Jorge Antunes' "Intervertiges." The other was American composer Leslie Bassett's "Concerto da Camera."

The next work was "Serenata" by the eminent Argentine composer, Alberto Ginastera. A setting for baritone, solo cello and small orchestra of poems by the Chilean poet and diplomat Pablo Neruda, "Serenata" was typically dramatic, though it seemed less compelling than Ginastera's finest music.