Lockheed Corp. yesterday reported earnings from operations totaling $14.8 million for the three months ended June 28 and $28.3 million for the first six months of the year, in contrast to losses it reported for the same periods last year.

During the comparable periods last year, the company reported net losses of $26.6 million for the second quarter and $14.6 million for the six months. Last year's losses reflected a second-quarter write-off of $70 million in excess production costs on the L1011 Tristar commercial transport program.

Polaroid, meanwhile, reported that, despite increased sales, its profits dropped by 11 percent in the second quarter.

Lockheed's net earnings for the first six months of 1981 were $51.1 million, including $22.8 million of extraordinary income recorded during the first quarter, the company said in its quarterly financial statement.

Excluding the extraordinary income, which resulted from the exchange of a new issue of $11.25 convertible preferred stock for approximately 85 percent of the corporation's 4 1/4 percent convertible subordinated debentures, earnings per share were 83 cents for the second quarter and $1.65 for the six months.

Polaroid Corp.'s U.S. sales improved in the second quarter, but a dip in foreign sales and losses due to fluctuating currency rates sent earnings tumbling 11 percent in the second quarter, to $13.4 million.

For the first six months of the year, earnings fell 29 percent to $22.9 million (70 cents) on sales of $615.3 million, compared with earnings of $32.5 million (99 cents) on sales of $625.5 million for the first half of 1980.