Not long into his career at City Hall, Mayor Koch began to assign some of the most onerous tasks in town to one member of his inner circle, with the full expectation that these problems - from closing hospitals to rounding up support for a large housing project - would be solved. Somehow, they were. The trouble-shooter was one of Mr. Koch's three Deputy Mayors, Robert F. Wagner Jr.

''I guess I'm just destined for these kinds of things,'' said the 39-year-old Mr. Wagner with a slight smile as he chain-smoked filter cigarettes in his office and pondered what may be the most difficult problem to come his way to date - serving as Chancellor of the city's school system.

The Board of Education selected him yesterday, ending a campaign that was heavily politicized, full of racial overtones and likely, Mr. Wagner readily concedes, to make what is normally one of the most formidable jobs in town even more difficult.

''Do I believe some of the tensions created by the process can be overcome?'' he said, asking the question and then answering it, in a manner not unlike Mayor Koch's rhetorical style. ''I believe they can be overcome. I believe it will be possible to heal some of the wounds. It will mean working to reach out to all communities, working harder.'' Ability to Make Peace

In other words, the new Chancellor expects to be able to do on his new job what he has done so often during his three and a half years as Deputy Mayor for Policy: make peace.

Like his father before him, the son of former Mayor Robert F. Wagner is said to be a mediator - negotiating, analyzing and generally smoothing things over in a City Hall where calm rarely makes an appearance.

''We could all be yelling and screaming about some budget issue or racial problem the Mayor got himself into, but not Bobby, he's never yelling and screaming,'' said Nathan Leventhal, Deputy Mayor for Operations. ''Suddenly the room would get all quiet and suddenly he'd give you a perspective nobody else had given.''

The Mayor and, it seems, everyone around City Hall make frequent forays to Mr. Wagner's small, impossibly neat office in search of elusive solutions to everything from resolving a conflict over school budget appropriations to finding a way to close Sydenham Hospital in Harlem despite angry community opposition.

''He took the losers and turned them into winners,'' said the Mayor. ''He has historical judgment. He has the Wagner genes.'' In many ways, trouble-shooting seems an unusual role for Mr. Wagner. He is a quiet, diffident man with pale blue eyes, a face that often seems sad and a manner so retiring that on the rare occasions when he does show anger, it stuns people.

Aides have said that he sometimes seems withdrawn, and he sometimes works at home instead of in his office, especially, Mr. Wagner said, when he has something to write. Friends often say he seems better suited to the more detached environment of academia and has recently, he said, considered offers from some universities.

Mayor Wagner's father was Senator Robert F. Wagner, a progressive Democrat best remembered for sponsoring the National Labor Relations Act. 'Bobby Was Always There'

Robert Ferdinand Wagner Jr., born on Jan. 6, 1944, was 9 when his father, a Democrat, began the first of three terms as Mayor. He attended private schools, lived in Gracie Mansion and played politics the way other boys played baseball. He remembers sitting in on hotel-room political meetings and joining his father and Alex Rose, the late Liberal leader, at lunch.

''Bobby was always there with me and always interested,'' recalled the new Chancellor's father. The family remains close and the Deputy Mayor, who is single, often spends weekends with his father and his stepmother.

''I grew up with politics and was fascinated by it,'' said the younger Mr. Wagner. After graduating from Harvard University in 1965, working on a doctorate at the University of Sussex in England and earning a master's in public affairs at Princeton's Woodrow Wilson School, he decided in 1973 to run for City Council and served four years as an at-large member from Manhattan.

But he was never comfortable pressing the flesh or raising campaign funds. So after losing a contest for Manhattan Borough President to Andrew J. Stein six years ago, Mr. Wagner served in appointive roles in the Koch administration - first as Chairman of the City Planning Commission and then as Deputy Mayor.

Neither job allowed him to show much independence from Mr. Koch, and some predict that he will not change as Chancellor. He will, pledges Mr. Wagner.

His talent as a conciliator emerged in both jobs - an ability that can be both a strength and a weakness, say those who know Mr. Wagner well.

The Deputy Mayor is someone who ''sits and listens with care,'' said Dall Forsythe, former executive assistant to City Council President Carol Bellamy. ''The other side of just this set of virtues is he finds it difficult to come to a conclusion. Sometimes, making decisions means making people angry. Bobby's tendency is to make people calm. But I don't think that's a fatal flaw. He makes decisions when he has to. He gets around to it. Like his father.''