LONDON, Dec. 17— A shy mathematics teacher who enchanted children and adults alike with a vivid fantasy world about a girl named Alice tonight joined the pantheon of literary giants in Westminster Abbey.

After an evensong service on the 150th anniversary year of his birth, Lewis Carroll, the author of ''Alice's Adventures in Wonderland'' and ''Through the Looking Glass'' was honored with the unveiling of a gray-green stone plaque placed on the floor of Poet's Corner. Inches away lie similar plaques to Lord Byron, T.S. Eliot, Henry James, and Dylan Thomas, whose stone was set only nine months ago.

Inscribed in off-white lettering in the center of a circular design on the stone is the writer's real name, Charles Lutwidge Dodgson, with his dates, 1832-98. Encircling this in boldtype is his pseudonym - Lewis Carroll - and around the edge the words, ''Student of Christ Church, Oxford, buried at Guilford.''

And from ''Sylvie and Bruno,'' Carroll's last work for children, comes the insription: ''Is all our life, then, but a dream?'' Among the relatives who attended the ceremony, which included the reading of an extract from ''Alice in Wonderland,'' were Philip Dodgson-Jaques, Carroll's great nephew,who uncovered the plaque..

Among the relatives who attended the ceremony, which included the reading of an extract from ''Alice in Wonderland,'' were Philip Dodgson-Jaques, Carroll's great-grandnephew, who unveiled the plaque, and the poet's 5- and 7-year-old great-granddaughters, who laid bunches of posies on it. America Is Represented

David Schaefer, the president of the North American Lewis Carroll Society, had flown over with his wife, Maxine, the society's secretary, to close the ceremony by laying a wreath.

The commemoration of this enigmatic Victorian - poet, storyteller, writer on logic and mathematics, and pioneering photographer - marks the culmination of years of effort by Britain's own Lewis Carroll Society to promote the poet's life and work, much of it about Alice Liddell, the daughter of the dean of the college where Carroll taught.

So far, $4,000 has been raised, mainly by subscriptions, toward the $4,800 needed to cover the expense of the plaque and the service. World-Loved Characters

''Carroll's characters are known and loved throughout the world,'' said Lindsay Fulcher, president of the 13-year-old society here. ''There are 20 editions of 'Alice' in the Soviet Union alone, and I have it in Norwegian, Gregg shorthand and Esperanto. We thought it scandalous that there was no national memorial to Carroll.''

So five years ago, the London society, which now has some 300 members from Europe, the United States and Japan, approached the Dean of Westminster, the one person who alone determines which poets enter the Abbey's hallowed nook. For four years, there was little response. Then, during the memorial year of Carroll's birth, the breakthrough came.

After consulting leading literary figures, including Britain's poet laureate, John Betjeman, the Very Rev. Edward Carpenter concluded that Carroll's literary fame had proved sufficiently lasting to propel his plaque into the little remaining space - now all on the floor - in the abbey's south transcept.

Illustrations: photo of Lewis Carroll