Age:40, early osteoarthiritis changes are seen on my knee x-rays. How to find out if it is primary or secondary? Any tests? Does hypothyroid cause it?

Possibly. There are several labs that can be done to distinguish other possible causes of arthritis, though there is no test that is specific for osteoarthritis and yes, thyroid problems can contribute to bone issues.