K mart Corp., continuing its diversification program, announced yesterday that it plans to test a variety of consumer financial-services programs in 31 of its stores later this year.

Following the lead of Sears, Roebuck & Co., the nation's No. 1 retailer, K mart said it will offer several financial services to its customers under five different agreements with outside companies. K mart is the nation's second-largest retailer.

In four stores in Las Vegas and nine in New Jersey, K mart will offer mortgage and home equity loans. K mart also will place four limited-banking service centers in its Richmond stores that will offer certificates of deposit, Individual Retirement Accounts, money-market accounts and consumer loans.

Full-service banking centers, with discount brokerage and consumer loan operations, will be established in four stores in South Bend, Ind. Real estate brokerage services for home, business and land sales will be set up in three stores in Michigan and two in Wisconsin. K mart also will create consumer loan centers in five Chicago stores.

K mart already offers limited financial services in more than 100 of its 2,000 stores. It has 100 insurance centers in Texas and Florida as well as 10 limited savings and loan centers in California.

These pilot programs will give the chain a chance to "see what works," said Robert E. Brewer, K mart's senior vice president of finance. "We will be able to see how well they do and whether they earn their space. They will be competing with our new merchandise concept, so they have to be good."

K mart expects to test the pilot programs for a year and then decide "whether to expand, add new services or drop those not in sufficient demand," Brewer said. Eventually, he added, some services may be offered in Washington-area stores.

The expansion into financial services comes at a time when K mart is trying to upgrade its existing 2,000 stores and their merchandise and diversify into other retailing areas.

During the past year, K mart purchased a cafeteria chain, Waldenbooks and Builders Square Do-It-Yourself home improvement stores. Just this week, the company announced a $500 million acquisition of Pay Less Drug Stores Northwest Inc.