Suppose I have a machine that lets me see the near future
First things first : secure this and have a discrete way to use it.
How near is near ?
investment strategy is dependent on how long terms your investment is for, but how suspicious your apparent success at picking investments will look is also dependent to some extent on how much time passes between buy and sell.
It also depends on how you deal with the sell part.
Selling at the peak every time will look suspiciously like you know too much.
Sell using conservative strategy that may not optimize your profit but will look like someone making reasonable profits consistently without having any suspiciously accurate judgment about when the price will peak.
Make the odd deliberate, but plausible, loss.
and I want to use this to get rich on the stock market. What is the best way to invest so that no one suspects that I'm doing something fishy ?
Be careful to avoid multiple investments which would have required you have insider information (in the absence of a time machine). Insider trading is illegal in many places and consistently seeming to have the inside track on private deals will make you look suspicious.
The authorities (and jealous investors) will be watching some deals more than others, so avoid high profile deals.
Also consider if you should invest directly in the stock market.
Again, depending on what "near future" means, choosing investment funds, rather than stocks, may be a better route. These avoid the problem of being a shareholder (and directly recorded as one), making it harder to target you as an insider trader.
Buying and selling shares is a public activity that's monitored closely. Perhaps better to e.g. act as a venture capitalist (depends on how far you can see into the future).
Holding stocks for a long time is a good strategy. Picking stocks when they're low and you know that (eventually) they'll rise is the ideal. Some people will call that luck, some will call it patient good judgment, but no one will think it's suspicious. This of course only works if your window is sufficiently far into the future to make that workable.
A "normal" investor will typically concentrate on one or two market sectors. It looks like expertise when you consistently pick winners in e.g. mining and concentrate on the mining sector. It looks like you're getting information from private sources, maybe illegally, when you can consistently invest successfully in different sectors.
Don't cherry pick the most profitable deals. It's tempting to do that, but it again makes you look like you're getting inside info. Simply pick deals that provide a solid, but not necessarily spectacular, growth.
Spread it around. Normal investors spread their portfolio around so as not to have all their eggs in one basket. You don't really need to do that as you have info from the future, but if you keep making successful everything-on-one-play deals you'll attract a lot of attention.
Do things that normal investors do : set stop-losses to trigger auto sells on stocks if they fall or rise above and below levels. Pick sensible values even if you know they're not relevant. This behavior makes you look look ordinary.
And, again, allow some plausible fails is desirable.
Spread bet. So this, as it, again looks like you're simply a cautious investor with good judgment who is afraid of loosing and has a backup plan. You don't actually need backup plan to minimize loss, but you do need to look like you do.
Avoid having friends who are in investment firms and banks. Nothing looks more suspicious than someone getting rich on a string of successful investments than someone with a string of friends in the banks and investment companies that handle IPOs and mergers and bank loans. If you have friends like these, never talk money with them. Never. Let's see the investigators get past "No, Bob has a rule - we're friends, no business talk, just fun.".
Last trick : do lots of "normal" market research. Just in case some nosy twerp starts asking questions, you want to be able to say, "why, I'm successful because I spend a lot of time researching companies and markets." Computers, accounts (you actively use !) with investment research firms that sort of thing.