President Trump loves the stock market — especially when it is going up.

But there’s really no way of guaranteeing that stock prices will continue to climb between now and the presidential election in November — unless, of course, the rig is in.

Considering how important the market is to the president, it’s not surprising that this idea is being considered: letting people treat a portion of their income as tax-free if the money is invested in the stock market.

One version being considered, it was reported late Friday, is that households earning up to $200,000 could invest $10,000 on a tax-free basis in stocks. That would be over and above the amount of tax-free money people can already put into a 401(k) retirement plan and invest anywhere they want.

Stock prices were headed for a substantial loss on Friday before word leaked out that this was being considered.

The losses were minuscule by the time the market closed for the long holiday weekend.

What does this idea accomplish? That’s easy. It might keep stock prices elevated — at least long enough to help the president. Even if the proposal isn’t enacted, just the idea that it is being proposed will help Wall Street.

What’s wrong with this proposal? In the first place, only 52 percent of Americans play the stock market. That figure is down from a peak of 62 percent before the Great Recession.

So only half of Americans (or the voting population if you want to look at it that way) would benefit from this proposal.

Second problem: This is being proposed when stocks are very expensive.

The current price-to-earnings (PE) ratio of the Standard & Poor’s 500 index is 19.2.

Historically, the average price-to-earnings ratio for the 500 S&P stocks is only 14.8. So, today’s stock prices would have to decline by nearly 23 percent just to get down to the historical average PE ratio.

That’s a long way of saying that the proposal now being considered by the White House would entice people to get into the stock market when prices are very high. It would be like encouraging them to buy a house in 2006, right before the real estate market collapsed.

Wall Street will love what the White House is considering. But should people be encouraged to buy stocks — or anything — when they could very well be overpriced?

Consider that a 23 percent decline would only get stocks back to their historical average PE levels.

Stock prices could easily sink below the average. So losses could be greater.

A proposal like the one now being floated by the White House has the potential to make people unhappy if things go wrong.

The US economy right now is growing at about 2.5 percent a year. That’s a nice rate but not nearly as fast as the White House would like. Corporate profits have been doing okay.

But something like the coronavirus that’s now haunting the Far East could affect the profits of companies worldwide. And if corporate profits decline, that, too, would make price-to-earnings ratios even more outrageous than they already are.

Some members of the Federal Reserve are starting to publicly express worries that the stock market is in a bubble. The reason for that bubble is the Fed’s monetary policy, which has kept interest rates low for a very long period of time.

The Fed can’t do anything about what the White House is considering. But if Jerome Powell, head of the Fed, doesn’t like the White House juicing the stock market, he might say and do things that could deflate equity prices, like hiking interest rates.

And there’s this more fundamental reason the White House’s new idea is a problem: It’s called the federal deficit, which was over $1 trillion last year, on top of the already $23 trillion in debt accumulated by the US.

A tax benefit like the one the White House is considering — essentially giving taxpayers an open-ended tax break to invest in stocks — would cost the US an untold amount in lost tax receipts. And that’ll make the deficit even worse.

A stock market crash would be a bad thing for Trump but not catastrophic if it happened, because it only affects half of Americans, many of whom already have made a large profit in the stock market.

But a crash after the White House forced more people into the stock market through additional tax incentives would be disastrous.

There’s one other problem with pumping up stock prices — it doesn’t necessarily boost the economy. Sure, companies like to see their share price rise. But it doesn’t spur them to build new plants or hire more people.

And while people may feel richer when the stock market is going up, they don’t necessarily act richer. Much of today’s stock market wealth is tied up in tax-advantaged investments that people will have to keep until retirement.

They won’t, say, sell off some IBM shares and pay penalties when they need a refrigerator.

One senior White House official said of the stock plan being considered: “Nothing’s ruled out. Nothing’s been ruled in, either.”

This idea should be ruled out.