During the last few weeks before Christmas, I spent considerable time pondering the subject of model trains. My 6-year-old son, Revell, had been talking of nothing but ''lectric'' trains all year. Although he was really too young for them, it had become increasingly obvious that his father was ready for one.

Selecting a train for a child is not a task to be approached lightly. The decisions made with regard to such options of scale as Gm, O, S, HO and Z, can shape or scar a person for life. If a child receives an HO set, say, and his friends all have O gauge, he will be isolated, unable to trade rolling stock and accessories.

At Flock, Stock & Barrel I began my pursuit of the right train in earnest. I discussed such weighty matters as whistle availability and smoke synthesizers with the owner, Larry MacNaughton, who is also a computer designer and systems developer. His company, MNTL Logic Laboratories, adjoins the trains, rockets and Dungeons and Dragons sections of his shop. So there we sat, next to the PDP-11 computers stacked like egg crates atop one of the work stations engaged in a deep philosophical discussion whose main refrain was ''Toot-toot, chug-chug and puff-puff.''

The selection of the train itself seemed to have narrowed in my mind to the HO gauge. The unresolved question posed by an HO set, however, was how a 6-year-old would be able to deal with the problem of polarity reversal.

Being a two-rail system, the standard HO track has one positive and one negative rail. In the ordinary course of events, when looping the track back onto itself, you will end up connecting a negative to a positive. The resulting short circuit is fine for learning about electricity, not so fine for running a model train.

There is a solution to this problem, needless to say. You complete the loop by installing a segment of track known as a reversing section. This is an electrically isolated block separated from the rest of the track layout by nonconductive rail joiners.

A large model train layout has numerous other isolated blocks besides reversing sections. Looking at the complexity of the wiring and the operational organization involved in a large layout, I muttered something to myself about the entire endeavor being more suitable to a computer than to a 6-year-old kid. It was then that I began to sense the parallelism existing between model railroading and computing. The logic flow, the switching circuitry and relays, the timing sequences and loops are the same. Only the scale is changed, reduced in size to the micromeasurements of today's computers, and instead of the model railroad buff shunting loads of passengers or freight around, delivering mythical individuals or goods to their various destinations, the computer hacker switches information around the electronic circuits, trying to make the computer deliver.

I was wondering if anyone else had ever thought of that parallelism as I drove over to The Train Exchange in Manchester, Conn. More importantly, how come model railroaders had apparently not yet taken advantage of the directing arts of the personal computer in running their hobby?

Then lo and behold, when I opened the door of the exchange, the first thing to greet my eyes was a Commodore 128. The premises of The Train Exchange, it turns out, are also those of a Commodore dealership.

The next thing I discovered was that model railroading has changed immensely since my youth. Model Railroads magazine now carries a regular C/MRI (Computer/Model Railroad Interface) column complete with program listings for your computer. There's even a SIG, or special interest group, for model railroaders, called the Computers in Model Railroading SIG, (8431 Timber Glen, San Antonio, Tex. 78250).

For those who have the computer but not the railroad, there's the program Train Dispatcher ($27.98 for the Commodore 64 from Signal Computer Consultants, Pittsburgh, Pa. 15236, telephone 412-655-7727). The software lets you operate an on-screen dispatcher's panel controlling up to 30 trains at a time.

''It's not just an eye-hand coordination game,'' said Robert Bell at The Train Exchange. ''You really have to think.'' You are faced with not only the train scheduling, but all the other operating problems of a real railroad, from crews that have been outlawed - that is, worked their maximum number of hours for the day, bringing the train to a halt until a new crew is aboard - to bad weather and wheels falling off. I have it on good authority that a number of real-life dispatchers from Conrail and Amtrak come by and rent the program regularly. Talk about a busman's holiday!

Then there are programs such as Mil-Scale ($19.95 for the Commodore 64 from Mil-Scale, Box 13612, Wauwatosa, Wis. 53213), which converts standard time into scale time. A large visual clock on the computer's monitor allows you to run your trains by SMILES, or scale miles, wherein 60 linear feet equal one real mile and time goes by 10 times faster than for us full-scale people.

So model railroading and personal computer hacking have definitely merged. All the same, what Revell is going to find under the tree this year is a straight, uncomputerized Marklin HO starter kit. The German Marklin line uses live center studs hidden in the crossrails as the source from which the engines draw their power. This feature eliminates both the polarity problem and the complex wiring of reverse loops needed as a result of it. With a 0-6-0 tank locomotive and an assortment of easy-to-handle two-axle European-style freight cars, the Marklin starter set is just right for his age.

I did notice in the Marklin catalog, I must confess, the newly released makings of a multitrain digital control setup complete with a personal computer interface. The computerized controller is said to be able to activate up to 256 switches and signals and run simultaneously as many as 80 locomotives.

Among the engines available for the setup is a lovely German Federal Railways 4-10-0 express that, too sophisticated for Revell, goes, well, not toot-toot and chug chug, but certainly puff-puff. Maybe next year.