Profits at the Student Loan Marketing Association, a government-sponsored corporation that buys student loans to provide additional capital for the educational lending market, climbed 18 percent in the third quarter to $77.9 million, the company said yesterday.

The third-quarter performance brought earnings for the nine months ended Sept. 30 to $223 million, compared with $189.6 million for the first nine months a year ago, according to the Washington-based company, known as Sallie Mae.

Earnings per share totaled 77 cents for the third quarter, up from 65 cents in the third quarter of 1989 and 65 cents in the second quarter of this year. For the first nine months, Sallie Mae earned $2.17 per share, compared with $1.89 a share in the same period a year earlier.

Company officials said the failure of the Higher Education Assistance Foundation (HEAF) -- a giant student loan "guarantor," or intermediary between the government and lenders, that makes guaranteed student loans -- had no material impact on its earnings.

Likewise, Sallie Mae's agreement with the Education Department to set up a special subsidiary to provide management services to HEAF as it winds up its operations will not affect profits, it said. Sallie Mae had been a major buyer of loans insured by HEAF.

Lawrence A. Hough, the company's chairman and chief executive, said the earnings increase "derives primarily from the continued strength of our student loan purchases." He also said the company's loan servicing products and services, such as computer software, have remained strong.

Sallie Mae's assets as of Sept. 30 totaled $40.3 billion, up 19 percent from $33.8 billion at the same date in 1989, and the company's student loan portfolio was $17.9 billion at the end of the third quarter. Most of the loans it buys are guaranteed by the federal government.

Sallie Mae finances its operations by borrowing in the capital markets. The interest rates it pays to borrow are generally less than those paid on the student loans it buys, and its profits come from that spread. The greater the volume of its assets, the better its earnings.

The company recorded interest income of $122.6 million in the third quarter and $353.2 million for the nine months ending Sept. 30.

Sallie Mae also said its board of directors had voted to buy back as many as 4 million shares of the company's voting and nonvoting common stock, including as many as 1.4 million shares of voting common.

First Virginia Banks Inc. of Falls Church said it earned $16.3 million (76 cents a share) in the third quarter, down slightly from $17.5 million (83 cents) in the same period last year.

For the first nine months, First Virginia said it earned $49.2 million ($2.30), compared with a profit of $50.8 million ($2.41) in the first nine months of 1989.

Chairman Robert Zalokar said a reduction in net interest margin and slowing loan growth prevented First Virginia from earning more in the first three quarters.

Zalokar said he believes First Virginia's cash reserves are adequate to absorb any potential losses from real estate and other loans. However, he said another $1 million was added to the reserve "as an extra precaution."

Total assets as of Sept. 30 were $5.2 billion, up 7 percent from $4.9 billion at the same time last year.