Cardiologists at Johns Hopkins Hospital in Baltimore have rated as excellent the health of Fairfax County Board Chairman John F. Herrity who suffered two heart attacks two years ago and now is seeking to win the congressional seat of Rep. Herbert E. Harris (D-Va.) in November.

Herrity underwent a special "stress test" Thursday at Johns Hopkins to test his physical endurance in response to speculation two weeks ago by Fairfax County State Del. Robert E. Harris (R) that Herrity might be unable to endure the stress of a campaign. Harris, a delegate to the Virginia General Assembly, is one of the likely contenders for the Republican congressional nomination.

"We can say confidently that his exercise duration is excellent compared even to active healthy men of your age who have never had a heart attact," said a letter by Dr. Leon Greene of Johns Hopkins evaluating Herrity's physical performance in the test. ". . . It is my opinion that you should be allowed to continue running, either with jogging shoes or for political office."

Herrity, who suffered two successive heart attacks in January and February 1976 shortly after his election as chairman of the Fairfax County Board of Supervisors, said he has been jogging 3 1/2 miles a day for eight months.

He said he took the stress test in part "to assure people they won't elect somebody to Congress who will kick the bucket the next day."