Dairyland Insurance Co., the No. 2 writer of auto insurance in the District, informed the city government yesterday that it is discontinuing insurance for all of its District policyholders by the end of this year because of high losses it has had here.

About 16,000 customers, most of them high-risk drivers with month-to-month policies, will have to scramble to get insurance from other companies or be put in a pool for uninsured drivers who are assigned randomly to insurance companies, according to city officials and insurance agents.

"We are pulling out of the District of Columbia," confirmed Paul L. Cashman, Dairyland branch manager in Richmond.

Cashman said his company has experienced high losses on policies here and sees no reversal of that trend because rate increases allowed by the D.C. Insurance Administration were not enough to cover costs.

The company will begin notifying customers in August that their policies will not be renewed, Cashman said. This will give those who buy their policies monthly 30 days to find a new company.

Dairyland, a nationwide company based in Wisconsin, generally insures high-risk motorists and jumped to second place in the city, behind Geico, after mandatory no-fault insurance went into effect in October 1983 and a large number of previously uninsured drivers had to find a company to insure them.

One of the reasons Dairyland became so popular was that it was about the only company that would provide a policy on a monthly basis rather than on a semiannual or annual term, so the initial cost was more affordable for low-income persons, said one insurance agent who asked not to be identified. He estimated that about two-thirds of Dairyland's customers buy on a monthly basis.

"All of these people are going to be very, very upset," he said. "It's going to be like it was two years ago when the no-fault law went into effect," when uninsured drivers swamped insurance offices looking for coverage, he predicted.

The insurance administration, which must approve all insurance rate increases, allowed Dairyland a 23 percent rate increase in the past year, but rates still are "nowhere near adequate" to make the insurance profitable, Cashman said. The rapid growth in the number of previously uninsured motorists insured by the company here contributed to the significant losses, he said.

Dairyland previously pulled out of Michigan for much the same reason, he said.

Another insurer of mainly high-risk drivers, Stonewall Insurance, left the District last fall, also saying it was not economically feasible for it to operate here, according to city officials and agents.

Lucinia Dunn, a spokeswoman for the D.C. Department of Consumer and Regulatory Affairs, which includes the insurance administration, said the insurance superintendent had not yet determined "what the full impact of the loss of the company to the District will be."

The insurance administration is looking into alternative plans for the company's 16,000 customers, Dunn said.

It is unclear just what will happen to the rates of those drivers. Some agents said there probably will not be an immediate increase and that some might even end up with companies that would charge them less than they are paying now.

One agent said that a typical driver put into the assigned-risk pool might pay $400 a year but would have to come up with $100 or $150 up front rather than paying $35 or $40 a month as that same driver might now with Dairyland.