A portrait of Thomas Jefferson by Gilbert Stuart has been jointly purchased, for $1 million from a private collection, by the National Portrait Gallery and the owners of Monticello, the house that Jefferson constructed in the Virginia hills.

The swiftly painted portrait was done, from life, in 1805 in Stuart's downtown studio here. It is the picture reproduced on the $2 bill.

The buyers split the purchase price. They will share the painting, too. It will be displayed in Washington, and then in Charlottesville, for alternating three-year periods.

That arrangement follows a precedent set in 1980 when the Portrait Gallery and the Boston Museum of Fine Arts together bought two other Stuarts, his "Athenaeum" portraits of George and Martha Washington. The Portrait Gallery paid $2.75 million for its share of those pictures; the Boston Museum paid somewhat less -- $2.125 million -- but still received half-ownership. The paintings, now on exhibition here, will be sent to Boston in the summer of 1983.

The Jefferson is painted on wood panel, not on canvas. Like Stuart's Washingtons, it seems incomplete. The wood grain shows through the pale-green background. Jefferson's jabot is a bright brush stroke of white, his coat a mass of black. Only his head is fully finished. He gazes at the viewer with intelligent attention. He hair was red, but in the picture it seems gray. Maybe it was powdered.

The portrait has been traveling. It was in Washington two weeks ago for an off-the-record press preview. It will be displayed in Kansas City until Oct. 3 and will spend the rest of October at the University of Missouri in Columbia. In early November it will go to Monticello to hang on the parlor wall where Jefferson installed it. Its first three-year stay in Washington will begin April 15.

Stuart (1755-1828), though the best American portrait painter of his time, was not a perfect gentleman. His behavior toward Jefferson was shabby.

Stuart requested the sitting. He charged the president $100. But Jefferson had to wait 16 years before he got his portrait.

Stuart first said he wanted to keep the picture in his studio so that he could have it reproduced in an engraving. Then, without informing the president, Stuart moved to Boston and took the picture with him. Jefferson sent off polite letter after polite letter, but to no avail. Stuart had his reasons. In those days before photography, politicians' portraits were often copied. Stuart no doubt kept the painting, as he did his Washingtons, to use as a model for the replicas he sold.

The picture was completed in 1805, just before Jefferson's second inauguration. When it arrived at Monticello in 1821, the retired president had but five years to live.

The portrait was inherited by his daughter, Martha Jefferson Randolph, who took it to Edgehill, her plantation. It is called the "Edgehill" portrait still. It was owned by her descendants until 1927 when it was bought by John B. Winant, a former governor of New Hampshire and later ambassador to Great Britain. Winant, in turn, sold it to Percy B. Straus of New York. It was then inherited, in 1943, by Mr. and Mrs. Donald B. Straus, from whom it was acquired.

The acquisition of the Jefferson was announced yesterday afternoon at the William Rockhill Nelson Gallery of Art, Atkins Museum of Fine Arts, in Kansas City, Mo.

Gallery officials say Kansas City was chosen "in honor of Jefferson's Louisiana Purchase of 1803." But Kansas City also is the home of the Enid and Crosby Kemper Foundation, which helped Monticello's owner, the Thomas Jefferson Memorial Foundation Inc., come up with its share of the purchase price. The regents of the Smithsonian Institution, acting for the Portrait Gallery, provided the other $500,000.

The Jefferson, a fine accompaniment to Stuart's Washingtons, fills an important gap in the gallery's collection. "How to find works of great artistic significance that deal with sitters of surpassing importance is the dilemma we strive to resolve," said Alan Fern, the gallery's director.