+0
1# It’s a waste of time to talk to him.
2# It’s a waste of time talking to him.
Do the two mean the same thing?
What difference do they have, if any?
Kindly you teachers tell me something about the question.
Thank you very much.
+1
norwolf1# It’s a waste of time to talk to him.
This might be slightly more likely if you are considering talking to him soon in the future.
norwolf2# It’s a waste of time talking to him.
This is more likely if you are describing his usual behavior as observed on various occasions in the past.
Of the two, this is probably the more common.

CJ
Comments  
Hello,
Both are used and grammatical, depending on the context.
The gerund form seems to be more universal.
I don't like to talk to Paul, he is not a good listener.
I don't like talking to Paul, he is not a good listener.
 CalifJim's reply was promoted to an answer.