AUSTIN, TEX., FEB. 12 -- The nation's 13,793 federally insured banks earned $5.65 billion in the third quarter of 1987, partially offsetting the staggering $10.6 billion loss in the second quarter, a research company reported today.

The banks thus managed to finish the first nine months of 1987 with a modest combined net income of $233.8 million, far below the $13.7 billion earned in the same period in 1986, said Sheshunoff & Co.

The calculations by the Austin-based company were based on figures supplied by the Federal Deposit Insurance Corp., which insures individual bank deposits up to $100,000. Industry results for the whole of 1987 will not be available for three weeks.

The second-quarter loss of $10.6 billion resulted chiefly from the substantial increases in loan-loss reserves the major money-center banks were forced to make to cover their troubled loans to Third World countries.

Alex Sheshunoff, president of the research company, said the banks' nonperforming loans, a leading industry indicator, declined a slight 0.12 percent in the third quarter from the second quarter.

However, for the nine months of 1987, nonperforming loans totaled $64.8 billion, a 34.4 percent jump since the end of 1986.

"Although most of the year-to-date figures for the industry paint a bleak picture, bank performance -- particularly income -- improved during the third quarter," Sheshunoff said.

He said that since the Oct. 19 market collapse, the attractiveness of bank certificates of deposit to investors has increased.

There was a 2.3 percent rise in loan demand in the first nine months of 1987 but it came mainly from the real estate sector.

More significantly, commercial and industrial borrowing was down.

"Given the overbuilt condition of real estate markets in many parts of the country, this is probably not a good sector from which to look for future growth and earnings," Sheshunoff said.

"But if history is any guide, it is probably a good place to look for future loan-quality problems," he said.

There were 203 bank failures, including 21 in which the government provided financial assistance, for the whole of 1987, up from 145 in 1986 and 118 in 1985.

Assets in those 203 closings totaled $9 billion, compared with $7.7 billion in assets of banks closed in 1986 and $3 billion in 1985. Banks in Northeastern states continued to perform well, reflecting the economy in the region.

Several Southwestern states continued to experience loan-quality problems.

Alaska banks had the highest percentage of nonperforming loans to gross loans, with 17.39 percent.

Texas with 7.53 percent, Oklahoma with 6.95 percent and Louisiana with 6.45 percent ranked second, third and fourth, respectively.