The nation's first plant to turn plastic items like foam coffee cups and hamburger trays into things like flowerpots, coat hangers and even fence posts opens next month.

And its creators expect the $4 million plant to change the reputation of the maligned material."I predict that the plastic bashing that's going on today will stop and polystyrene will become an environmental hero," said Robert J. Barrett, safety environmental officer at Mobil Chemical Co. of Rochester, N.Y., one of two backers of the factory.

The plant, called Plastics Again, is a converted warehouse with machines that can turn 3 million pounds of dirty cups, trays and cutlery - the amount that 1,000 schools throw away yearly - into hard, pea-size pellets.

Mobil and Genpak Corp. of Glens Falls, N.Y., hope to use the pellets themselves and sell them to other companies for making wall insulation, fence posts, flowerpots and packing material, or anything not dealing with food because of the danger of contamination. They expect a profit by 1992.

Barrett sees a lucrative market because the nation uses 5 billion pounds of polystyrene yearly.