The Interstate Commerce Commission ordered the nation's railroads yesterday to roll back freight rates on seven commodities, a move that will result in refunds to shippers of nearly $25 million and future savings to shippers and consumers of an estimated $50 million annually.

The action involves a 1977 ICC approval of an interim 5 percent rate hike on the commodities, which was subject to an investigation and possible refund if the supporting data used for the hike was considered unreasonable.

In the initial petition requesting the 5 percent hike, the railroads contended that the additional $937 million that would be provided by the increase was needed to offset more than $1.1 billion in added costs for labor, materials, fuel, equipment and supplies.

But the commission, after it appeared that the rates on the commodities were already profitable, ordered an investigation.

In yesterday's order limiting the rate increases, the agency noted that railroads should not be allowed to meet their need for additional revenues by applying a general increase to rates "which were already high, unless the carriers separately justified the increase on those rates."

"This," the ICC said, "the railroads failed to do."

Each of the following commodities had been approved temporarily for 5 percent rate hikes. They are shown with the increases finally approved yesterday:

Newsprint paper, 3 percent; Sodium Alkalies, 2 percent; Industrial Gases; 2 percent; Sulphuric Acid, 3 percent; Natural or Synthetic Rubber, 3 percent; Manufactured Iron or Steel, 3 percent; and Recyclable Commodities, 3 percent.

The commission concluded in its evaluation that general across-the-bard rate increases "tend to discourage experimental ratemaking." The ICC is encouraging a lessening of regulation through more experimental and open rate-steting practices.

Claiming that general rate increases "provide an easy answer to the problem of rising costs and inadequate earnings," the ICC added that "they have many recognized disadvantages, including the burden placed on higher-rated commodities that bear a disproportionate share of such increases. In the long run, across-the-board adjustments they may actually lead to a decline in revenues as a result of diversion of traffic to competing modes."