Western and Third World countries representing two-thirds of the membership of UNESCO agreed informally yesterday on a draft text of the resolution on news media that has been a source of bitter dispute for more than two years.

Several days of behind-the-scenes negotiations were successfully concluded. U.S. delegation sources said, and the draft text will now be sent to capitals for final approval. A vote on the resolution has been scheduled for Wednesday.

Efforts to get the Soviet-bloc nations to accept the draft came to nothing in a meeting between Soviet and U.S. representatives to the U.N. Educational, Scientific and Cultural Organization's current biennial general conference. Much could happen between now and Wednesday to undo the informal agreement among 26 Western nations and 44 developing countries in the 146-member organization.

American sources expressed measured optimism, however, that the Soviets would rally to the draft to avoid being isolated, rather than try to bring pressure on Third World countries to reverse themselves.

Objections of western nations to the original draft presented at a UNESCO meeting in Nairobi two years ago were so strong that the organization's secretariat agreed that it was better to seek a consensus than to put the issue to a divisive vote.

The Americans said the new draft had met all the Western criticisms of the original text that obliged governments to see to it that the news media refrained from anything that could be interpreted as favoring racism or advocating war. Western governments objected that in the hands of dictatorial governments tris could be used as a pretext to muzzle the local press and to restrict news gathering by foreign correspondents.

At one point this week the United States, which had been considered the strongest delegation in defense of press rights, was nearing accord on a text with the Third World representatives only to have it repudiated by the West Germans, Swiss and Austrians. They rejected it as ambiguous with language that could be turned against the press.

The text of the new draft was not immediately available but conference sources said it satisified Third World demands for a declaration against racism as well as the need for industrialized countries to help developing ones form media of their own to break out of the world information monopoly of Western news agencies.