The Securities and Exchange Commission has charged the nation's largest mechanical contracting firm with funneling $1.391 million in illegal payments to a foreign official in violation of antibribery provisions of the Foreign Corrupt Practices Act and antifraud provisions of federal securities law.

According to the SEC, Sam P. Wallace Co. of Dallas and two of its officials were responsible, directly or indirectly, for payments made in six installments "to aid Wallace in procuring and maintaining certain contracts and billings with a certain foreign government."

Wallace and one of the officials involved consented to a court-ordered permanent injunction against similar acts in the future without admitting or denying the SEC's charges. Wallace Chairman and Chief Executive Officer Robert D. Buckner did not consent to the order. As part of the court order, the company agreed to set up a special review committee to investigate the matter and report back to the court and the SEC.

According to the company, the SEC complaint resulted from its voluntary disclosure of information obtained during routine company audits. The company also said that a preliminary investigation of its own indicated that no officer or employe of the company benefited personally from the alleged payment. The complaint did not disclose either the identity or nationality of the foreign official.

Wallace officials said that the payment did not involve Ghaith Pharaon, a Saudi Arabian businessman who indirectly holds 65 percent of the company's outstanding stock. One of the company's recent projects is a $37 million contract for the Jedda International Airport in Saudi Arabia.

The company has divisions in Caracas, Venezuela; Sao Paulo, Brazil; Trinidad, West Indies; Cairo; Egypt; and London. Executive Vice President Alfonso A. Rodriguez, the other official named in the complaint, has been a regional manager of Wallace's Inter-American Cos.

According to the complaint, the payments began in April 1980 and continued at least through March 1981. The company and the two officials disguised and concealed the payments by false accounting entries that did not reflect what was done with the money, the SEC charged. The company also filed an annual report and proxy solicitation with the SEC that failed to disclose the activities, the SEC said.