Against a backdrop of violence, hostility and tragedy, the Christian world prepared yesterday to mark the birthday of the man it worships as the Prince of Peace.

Warring halted in Central America but flared up in the Middle East. Political prisoners were jailed in Chile and protested about in Poland and Libya, while in South Africa, a limited amnesty was announced. Holiday mishaps caused dozens of casualties in South Africa and Thailand.

But in Bethlehem, Israeli Prime Minister Shimon Peres, a Jew, made a precedent-breaking Christmas Eve visit that Christian Arab leaders saw as a sign of hope, and famine-stricken Ethiopians reacted rapturously to the news that Mother Teresa would arrive today for a Christmas visit to relief camps.

And in Vatican City, Pope John Paul II hailed the birth of Jesus, saying at a midnight mass that Christ's "message of hope" endures even for a troubled world.

While Christians prepared to celebrate Christmas, Jews around the world prepared to light the eighth and last candle in the traditional celebration of Hanukah, commemorating the rededication of the Temple in 165 B.C., which this year coincides with the Christian holy day.

In his sermon at St. Peter's Basilica, televised to 36 countries, the pope said that "we belong to that generation that has openly shifted the emphasis from God to the world," adding that "some people think: are we not perhaps already in a post-Christian era?"

But in a world faced with "a permanent nuclear threat, and forms of human exploitation and . . . the scourge of famine," he said, "we gather together . . . with our hearts open to receive the message of hope that Christmas brings today to humanity."

In Peking, several thousand Chinese packed the city's few Christian churches for midnight services, many of them planning to stay the night. An old woman who arrived with a quilt for an overnight stay also brought a coal brazier to heat a meal, The Associated Press reported. "Many people stay all night and then cycle home in the morning," a worshiper at Immaculate Conception Cathedral said.

The Rev. Qan Xueqing, pastor of the Chongwenmen Christian Church, said that unlike in many countries, Chinese Christians have no special Christmas meal. "It's not like Americans, who bake turkeys," he told AP. "A family here might prepare jiaozi" -- a spicy pork-and-cabbage dumpling dish.

Peres, the first Israeli prime minister to join in the Christmas Eve celebration in Bethlehem, in the occupied West Bank, said he brought "a special greeting from the Jewish people living in Zion -- a greeting of peace from those who seek peace."

A close aide told the Los Angeles Times that the prime minister had initiated the visit to Bethlehem. "If you were to write that it is part of a new attitude, I would say that you were an astute observer," the aide said.

Bethlehem Mayor Elias Freij, an Arab Christian, prepared a table of kosher food for Peres and those accompanying him and called his visit "a nice gesture," adding, "I hope that 1985 will be a year of political initiatives and moves toward solving the Arab-Israeli crisis."

In Manger Square, The Associated Press reported, thousands of tourists and local Palestinian Christians gathered for an evening of carols by visiting choirs after an afternoon procession to the 1,600-year-old Church of the Nativity led by Msgr. Giacomo Giuseppe Beltritti, the Latin patriarch of Jerusalem.

In Lebanon, fighting broke out between Christian and Moslem forces in Beirut and Tripoli, dampening the holiday. "The Christmas spirit has been shattered," an East Beirut shopkeeper told United Press International after artillery shells crashed into the area. "I spent last Christmas in a basement shelter. I hope this one will be calmer."

A rebel truce was largely being honored in El Salvador, however, with only a minor skirmish reported.

A lull in the attacks on Persian Gulf shipping allowed European owners of salvage vessels to deliver Christmas trees and turkeys and taped religious services to the crews, which, nevertheless, were kept on standby alert.

In Libya, an envoy of the archbishop of Canterbury held a Christmas Eve service for four Britons who have been held as political prisoners since June, when Britain arrested five Libyans after a British policewoman was killed by shots from the Libyan mission there. Terry Waite, the envoy of Anglican Archbishop Robert Runcie, said he would try to negotiate their release.

Eleven Solidarity supporters, including a Roman Catholic priest, began a four-day fast in Gdansk, Poland, to protest the jailing of a colleague, Andrzej Gwiazda, who was arrested a week ago at a Solidarity demonstration, and to call for the release of political prisoners there.

In Chile, police arrested two Roman Catholic priests, including the Rev. Denis O'Mara of Chicago, for distributing Christmas cards that wished Chileans a new year "without torture," a reference to alleged practices of Chile's military government. A nun and two lay workers also were arrested.

South African President Pieter W. Botha announced an amnesty of sorts as a gesture of "Christmas good will." It will pardon 44 long-term prisoners as of Jan. 1 and will allow the early release in the next few years of 41 others, but it will affect only prisoners over 65 years of age -- including one who is 78 and another 76. Botha, in a Christmas address, said his strictly segregated country stands on the "threshold of an exciting era of peace and prosperity for all."

Meanwhile, at least 42 blacks were killed in South Africa when their bus plunged over a mountain precipice. The passengers were traveling from Cape Town, where they work but are not allowed to live, to their homes in black villages to celebrate Christmas.

A Christmas fair in Thailand ended in tragedy with four persons killed and 11 wounded when a grenade that was part of an exhibit blew up after a youngster tampered with it.