A 370-year-old painting by the Flemish master, Peter Paul Rubens, was bought yesterday by Britain's National Gallery of Art with government money for nearly $6 million, eight times the previous record for a Rubens and the second-highest price for any painting in art history.

The painting, "Samson and Delilah," was put on display among the many other Rubenses in the venerable gallery on Trafalgar Square just a few hours after it was bought on behalf of the gallery by noted British art dealer Sir Geoffrey Agnew at a dramatic auction at Christie's here.

His successful bid of 2.3 million pounds sterling, nearly $5.5 million at yesterday's exchange rate, is the third-highest auction price in history, just 10,000 pounds sterling less than a Velazquez portrait of Juan de Pareja sold at auction here in 1970. With the addition of a 10 percent commission now charged by the auction house, the total price paid by British taxpayers of nearly $6 million is second only to the $6.4 million paid for J. M. W. Turner's "Juliet and Her Nurse" at Sotheby Parke Bernet in New York in May.

The enormous inflation in art prices at auctions in recent years is well illustrated by comparing this sale to the old Rubens record of just 275,000 pounds sterling -- about $650,000 at yesterday's exchange rate -- paid for "The Adoration of the Magi" at Sotheby's in London in 1959.

The money for "Samson and Delilah" comes from this year's National Gallery purchase grant from the government of just over $7 million. A spokesman for the gallery said it was pleased to get "this magnificent painting" which represented "an aspect of the painter's style not previously included in the gallery's collection."

The 6- by 7-foot canvas was believed to have been painted in 1610, when Rubens was 33 and had just returned, after nearly a decade in Italy, to Antwerp, where he made his home for most of the rest of his 63 years.

It is a somewhat unusual Rubens, dominated by large figures of Samson and Delilah in the foreground. Samson, his naked, muscular trunk glistening, is asleep, with his head in Delilah's lap, while a man cuts his hair. The brightly lit colors in the foreground, particularly a scarlet cloak flowing from Delilah's lap, contrast sharply with the dim background.

The large painting hung dramatically above the bank of telephones used to receive bids that were called in to Christie's main auction room, where they watched the auction on closed-circuit television and telephoned their bids.

Agnew, who turned 72 today, was in the main room, bidding for "Samson and Delilah" by hand against an anonymous bidder using the telephone in the other room in a three-minute bidding duel. The painting was being sold by a European family whose identity was not revealed by Christie's.

"It was more or less the price I expected to pay," Agnew said later. "I have no idea who the other bidder was. All I know is the British public have a unique picture. It is a magnificent example of work of one of Europe's greatest artists. The country's taxpayers will find it fascinating if they go along to the gallery and have a look at it. I feel very honored to have been chosen to buy it. It is a rather nice feeling to have pulled it off. I will celebrate both my birthday and the buying of the painting tonight."

Most of the several hundred British taxpayers in the gallery during the two hours before closing time last night were equally enthusiastic.London postman Patrick Murphy said the painting was "worth every penny. It's brilliant. In a time of recession, it is a lot of money, but it is worth it." b

The biggest previous buy made by the gallery in recent years, Titian's "The death of Actaeon," -- bought for about $3.5 million in 1972, necessitated a public appeal to raise a million dollars needed to supplement the government grants available then.

The National Gallery's other Rubenses include "The Rape of the Sabine Women" and works painted by Rubens while he stayed in England in 1629 and 1630 as a diplomatic envoy accredited to the Dutch government but acting as an intermediary between Spain's King Philip and England's King Charles I. Rubens also made sketches here for an extraordinary group of paintings that still decorate the ceiling of Charles I's banquet hall in Whitehall.