Prince George's County's 850-member police union last night narrowly approved a two-year contract that will give officers no cost-of-living raises but ensure job security.

Fraternal Order of Police president Mahlron Curran said the tally of two days of balloting was 353 to 310 for the contract. Curran, who said he had expected a close vote, attributed the narrow margin to a split between those union members who wanted to protest the lack of cost-of-living raises and those who wanted to demonstrate support for the county's recently elected administration headed by County Executive Parris Glendening.

Glendening's original budget proposal called for police layoffs. Although he announced yesterday that he was revising his budget to avert layoffs anywhere in the county government, Curran said that many union members voted to ratify the contract to protect their jobs.

The two-year contract, to run from July 1 until June 30, 1985, contains a job security provision that prohibits any layoffs during the first year. The contract permits the union to reopen over salary in the second year.

The contract also decreases the work week from 42 hours to 40 hours, provides for a few improvements in retirement benefits and increases so-called "special duty" pay for officers in assignments such as canine patrol and emergency services.