WASHINGTON (AP) _ Milk prices paid to dairy farmers in 1987 may average a bit more than last year, and retail prices of dairy products are expected to edge higher the remainder of the year, a new outlook report by the Agriculture Department said Monday.

Analysts said that ''for all of 1987, milk prices may be slightly higher than the $12.51 per hundredweight'' farmers received in 1986.

Year-to-year increases in retail prices of dairy products ''are likely to continue to trail the averages of all food and all (consumer) items, although retail dairy prices will rise during the rest of 1987 in response to seasonal increases at the wholesale level,'' the report said.

For all of 1987, retail prices of dairy items as a group will probably be up 1 percent to 3 percent from 1986, the report said.

''This spring, prices of major manufactured dairy products were below a year earlier,'' the department's Economic Research Service said. ''However farm milk prices were close to last year, supported by higher byproduct prices and more active competition for milk supplies.''

The agency said milk production continues to decline from year-ago levels but at a diminishing rate as the government's whole-herd buyout or Dairy Termination Program (DTP) nears its end.

Under the program, which began April 1, 1986, dairy farmers contracted to dispose of more than 1.5 million cows, heifers and calves, and to remain out of milk production for at least five years.

''Fewer DTP cows were killed in recent months than a year earlier, easing the decline in milk production to 2.6 percent during April-June,'' the report said. ''Milk output by non-DTP farmers has been somewhat erratic. By late spring, these producers had about the same number of cows as a year ago.''

Milk production in 1987 now is expected to be down 1 billion to 3 billion pounds from last year's 144.1 billion pounds, the report said. That is slightly less of a decline than had been indicated earlier, when production was forecast to be down about 1.4 billion to 4.3 billion pounds.