DOLLEY MADISON didn't like The Octagon. President James Madison had not been well since they took refuge in the mansion belonging to Col. John Tayloe after escaping the burning of the White House. The mansion, built in 1799 at 1799 New York Ave, NW, had its problems. The roof leaked, the cellar was damp, the servants were sick, the rent was high.

In 1814, after the attack on the capital by the British troops, there were few places suitable for the accomodation of the President and his wife. Despite its location just a short distance from the White House, the Octagon (and Mrs. Madison's macaw, hastily brought over by her maitred) was saved from the British fire because it was temporarily occupied by the French ambassador, who flew his country's flag to save the property.

In any case, Mrs. Madison, with her customary good spirits, made do and began again her famous Wednesday night soirees, instituted earlier at the White House after Thomas Jefferson's pell mell republican parties so offensive to the European taste.

This Wednesday night the 163rd anniversary of Dolley Madison's soirees at The Octagon will be celebrated by the invitational opening of the first exhibit ever to focus on Dolley Madison, her taste, her times and her temperament.

Ironically, the exhibit will be in The Octagon, where she complained of the bad air, and not in her house on Lafayette Square, the scene of her great social triumphs during her widowhood; nor in the White House, where she reigned as hostess not only for her husband, but before that for Thomas Jefferson. In all, she was friend to 11 presidents. "Dolley and the 'great little Madison'" will open to the public Thursday in the historic Octagon, now owned by the American Institute of Architects Foundation.

In the circular upstairs room of The Octagon, the Treaty of Ghent, ending the War of 1812, was signed by President Madison. The house is often called the second most-haunted house in Washington (the first, of course, being the White House).

For the show, a mannequin, dressed in a shrimp-red velvet gown, will stand in the Treaty Room. Conover Hunt-Jones, curator of the show, strongly suspects that the dress was made from the red velvet draperies that Dolley Madison and Benjamin Latrobe hung in the White House's oval room. The same ones, indeed, that Dolley Madison saved from the British burning. Along with the portrait of George Washington and a bit of silver, the dress is heavy upholstery-weight velvet, faded rather unevenly. In any pase, the draperies were never heard of after the fire; and it is well known that most of Mrs. Madison's clothes were lost in that conflagration.

To step into The Octagon's drawing room during the exhibit is to be the guest of Washington's grandest grande dame. The Octagon's drawing room has been furnished as a Madison period room. All the furnishings once were owned by the Madisons. The card table against the wall was one where Dolley, despite her Quaker upbringing, sometimes played. It may well have been the one where her son by her first marriage, Payne Todd, lost the money his mother gained by the sale of his stepfather's papers. The card table was made by Charles Honore Lannuier in New York in the early 1800s. The White House has a number of his works.

Against the wall is a handsom French gold pier-console mirror, from Montpelier, the Madisons' Orange County, Va., country home. The ensemble represents the French taste, introduced to the Madisons by James Monroe, though today the table is somewhat scuffed up by generations of cats. Still, in that period, few furnishings owned by the First Families were new. Most were bought at auction in Paris by American diplomats or in this country from foreign diplomats on their departure.

On another side is Madison's favorite campeachy chair, with its x-shaped base and embossed leather sling, an early version of the Barcelona chair. Madison, the "father of the Constitution" was a great reader, and he would sit in the chair in the morning, reading his weighty tomes. The chair was thought to be the ultmiate in comfort and suitability. Jefferson had at least two. The name came from a variety of mahogany. Two armchairs are in the neoclassical Louis XVI taste. They likely were in Madison's bedroom suite. The Empire-style chairs were used in Mrs. Madison's bedroom. According to the story, the chairs were given to her by Lafayette after his triumphal tour of the United States in 1825.

The dining table here is only the ends of the original, the center having been lost long ago. The Madisons, who often had as many as 23 house guests in Montpelier, had several tables in their dining room. One table, lent the exhibition, was still being used in its owner's breakfast room.

In the show as well are Madison china and other oddments. The long-missing portrait of Madison by James B. Longacre, the last-known portrait that only surfaced recently in an estate sale, is now on view as well as another life portrait by A. B. Durand. In the portraits of Madison, you can see why it was said that he looked like a school master in mourning for a student he had whipped to death.

The portraits of Dolley Madison are kinder, showing her as a handsome young woman - she was 26 and he was 43 when they married after a brief four-month courtship - and, in an unforgetaable Matthew Brady photograph, as an 81-year-old widow. In all her pictures, she wears her famous turbans, perhaps an adaptation of the modest Quaker bonnets she was brought up to wear, perhaps because her own hair was thin and scraggly. The black curls hanging out were admittedly false. She (scandal) also rouged her cheeks, right to the last - even when she gave up her elaborate dress for widow's weeds.

The documents, assembled by Hunt-Jones, trace the history of what has been called one of the most successful marriages of all time - despite the gossip that swirled around their heads initially. She was said by some to be the daughter of a bawdyhouse keeper. In fact, her mother kept a boarding house, a genteel occupation for a widow of the times. It was through a boarder, Aaron Burr, another one of Dolly Todd's admirers, that she was introduced to the man she called in a letter, "the great little Madison." In point of fact, she and Madison were both said to be 5 1/2-feet tall, though because she was buxom ("her neck and bosom, the most beautiful ever seen"), she seemed much bigger than be. Because she and Madison had no children, there was talk that he was impotent. The truth is like never to be known, because on her instructions, all letters and private papers were burned at her death, as were Martha Washington's.

To Hunt-Jones, the evidence indicates that the marriage was very happy. Though she did find a letter, written on Dolley's wedding day to a friend, signed first Dolley Payne Todd and then in a postscript as Dolly Madison, with the cryptic notation "alas, alas." The bottom of the letter is torn off.

Dolley Madison was enormously successful as a political hostess, as a salon-keeper, as a decorator of houses and as a figure of fashion. And if she was extravagant, ordering so many dresses from Paris that her husband was scandalized, well, everyone did enjoy seeing her look well turned out. In the years after the presidency, when they retired to their country home, Dolley Madison continued to entertain her husband's constant callers.

And in his old age, she stayed closely at his bedside.

After his death, and the ruin of his fortune - her son was even more improvident than she was - she moved to Lafayette Square in Washington, in the house on the corner of H Street and Madison Place, which still stands, though altered.

Because, after all, The Octagon, is a house devoted to architecture, the show has many tantalizing tidbits of early architectural artifacts: the orginal sketch by William Strickland of the White House after its burning; sketches by Benjamin Latrobe of furniture and other designs for the White House and plans and sketches of Montpelier house and gardens, showing Thomas Jefferson's influence.

The exhibit is accompanied by a lively, yet learned, cataloguue by Conover Hunt-Jones. Lady Bird Johnson wrote the revealing forward, explaining, perhaps more frankly than you'd expect, why she felt kinship with this other First Lady:

"In her private life, Dolley was a bulwark and a valued adviser t tto her husband who was President during a period of factional politics and an unpopular war. In her public role as hostess at the White House, she was able to rise abbove partisanship, welcoming eeveryone at her 'drawing room' regardless of political affiliation. She knew that a well planned social season in the President's House bolstered the morale of the people and calmed a disturbed nation . . . Dolley was an intelligent woman who understood far more above current affairs than her contemporaries were allowed to guess . . .

"But it was the combination of President and Mrs. Madison that I found most fascinating. The love she and James felt for their Virginia plantation was similar to the feeling Lyndon and I shared for our ranch in Texas . . .

"The marriage of James and Dolley Madison was a partnership. It made their private relationship a comfortable one and provided a strong foundation for the period during which Madison was President and Dolley was First Lady. Their story, as told in this exhibition and the publication that accompanies it, offers its own subtle lesson for the world in which we live today."

The show, which cost $250,000, according to Jeanne Butler, AIA Foundation administrator who oversaw the project, was largely financed by the National Endowment for the Humanities and Philip Morris Inc. After it closes here at the end of January, it will travel to the Mint Museum of Art in Charlotte, N.C., and the Virginia Museum of Fine Arts in Richmond.