Relying on its government contracting and electrical engineering operations, McLean-based Dynalectron Corp.'s first-quarter earnings surpassed last year's record first quarter by 67 percent, although revenues were roughly the same, the company reported yesterday.

Southern Railway blamed the harsh winter on a 23 percent decline in its earnings, and UNC Resources reported lower profits. A.H. Robbins Co. of Richmond said its profits were off because sales of cold remedies weren't as good as last year.

Dynalectron had first-quarter profits of $1.7 million (20 cents a share) compared with $1.03 million (12 cents) for the first three months of 1981. Revenues were $107.2 million this year compared with $107.7 million last year.

A company spokesperson attributed the performance to "excellent strength in government services, aircraft maintenance for commercial airlines and a nice inprovement in our electrical contracting."

UNC Resources called its first-quarter results favorable, posting net earnings of $3.6 million (31 cents a share) on revenues of $105 million.

First-quarter 1981 earnings of $8.3 million (78 cents), on revenues of $96.8 million, included nonrecurring gains from several property sales and a special uranium transaction, according to Keith A. Cunningham, president and chief executive of the Falls Church company. UNC, which has reorganized its businesses significantly since last year, did not report results of comparable operations.

Swiftships Inc., acquired in January, contributed favorably to the first-quarter results, Cunningham said. He said he expects second-quarter figures to reflect slow recovery from current business downturns, but "we expect a strong performance during the balance of the year.

D.C.-based Southern Railway Co. was snowed in and snowed under in the first quarter, attributing its nearly 28 percent decline in earnings to the recession and a severe winter.

Southern earned $42.8 million ($2.72 a share) in the first quarter compared with $59.1 million ($3.79) for the same period last year.

Harold H. Hall, president and chief executive, said Southern exercised strict cost controls to help hold the reduction in earnings to a minimum. "It was the third-highest first quarter in our history, and we are pleased with having done as well as we did in view of the weather and the economic environment," he said. "The January weather, in particular, caused significant interruptions in traffic movements."

Southern, merging June 1 with Norfolk & Western Railway to become Norfolk Southern, is a more diversified hauler than its soon-to-be partner, which posted record earnings. N&W's business relies heavily on transporting coal.

Southern's operating revenues declined 6 percent to $411.3 million for the period. However, piggyback revenue for the quarter gained 12 percent over the first quarter of 1981. Total operating expenses were up by 0.3 percent to $345.2 million.

At Richmond-based A.H. Robins, a pharmaceutical company, severe winter weather didn't translate into increased demand for its cough and cold products, and sales and earnings declined during the first quarter.

Sales for the three months ending March 31 totaled $108.7 million, a 5 percent drop from the $114.6 million in sales for the first quarter of 1981.

Net earnings were $11.3 million (45 cents a share). This is a 17 percent decline from earnings of $13.6 million (54 cents) for the same period last year.

Profits at Doughtie's Foods Inc. of Portsmouth, Va., leapt about 140 percent in the first quarter of this year, although sales gained less than 10 percent.

Earnings were $153,000 (20 cents a share) on sales of $11.8 million compared with profits of $64,000 (8 cents) on sales of $10.9 million.