For three weeks each August, the beautiful castle city of Edinburgh becomes the cultural capital of the world. This year marks the 41st Edinburgh International Festival of music, opera, jazz, theater, dance, film and a variety of other arts.

Each day, from Aug. 9 to Aug. 31, a full calendar of performances is scheduled from morning to evening in more than a dozen concert halls and theaters.

Featured throughout the 1987 season are the arts and performing artists of the Soviet Union, a celebration of the string quartet and tributes to American composer George Gershwin on the 50th anniversary of his death.

Among the festival's other highlights: Festival Cavalcade: A grand parade passes the length of celebrated Princes Street to get the festival off to a lively start. Aug. 9 at 2:30 p.m.

Gala Opening Concert: The orchestra of the Bolshoi Theatre of Moscow offers a program of Russian classics, including Tchaikovsky's Symphony No. 5. Aug. 9.

"Mary Stuart": Friedrich Schiller's monumental play, based on Mary, Queen of Scots, is presented throughout the festival by the Scottish Theatre Company. This year is the 400th anniversary of Mary's execution.

"The Magic Flute": The Folkopera of Stockholm brings a new production of Mozart's great opera to Edinburgh. Aug. 11 to 15.

Glenlivet Fireworks Concert: This late-evening concert by the Scottish Chamber Orchestra concludes with a world premiere of the Glenlivet Fireworks Music. Aug. 20 at 10:45 p.m.

Edinburgh Festival Fringe: Alongside the principal festival, 450 performing arts companies from all over the world present productions from morning to night on the city's streets and stages and in its churches and theaters. Aug. 9 to 29.

Edinburgh Book Festival: Reputed to be Great Britain's largest book festival, it offers thousands of new books for browsing, visits by 150 authors and a children's fair. Aug. 8 to 23.

"New Scottish Art": A major exhibit of the new work of more than a dozen young Scots at the Scottish National Gallery of Modern Art. Aug. 9 to Oct. 25.

For a brochure of festival events and a ticket order form, contact: British Tourist Authority, 40 West 57th St., New York, N.Y. 10019, (212) 581-4700. Tickets also are available through the New York ticket agency Edwards and Edwards, (800) 223-6108. Open daily except Sunday, 9 a.m. to 8 p.m.